Answer by oNare for How to duplicate related rows
Why don't you make a third table called projects_payment and you use to make a relationship between projects and payments. projects_payment table should be like:projects_payment: project_id (PK) (FK to...
View ArticleAnswer by RolandoMySQLDBA for How to duplicate related rows
## Get the Latest ID in Payments#SELECT MAX(id) INTO @MostRecentID FROM payments;## Get the amount for the Latest ID in Payments# Insert Today's Date and that amount#INSERT INTO payments...
View ArticleAnswer by Praveen Prasannan for How to duplicate related rows
Are you looking for last_insert_idINSERT INTO payments (date, amount) ;SET @last_id_in_table1 = LAST_INSERT_ID(); SELECT CURRENT_DATE date, amount FROM payments WHERE id = @last_id_in_table1;
View ArticleHow to duplicate related rows
Tables: Payments with auto-increment ID and one-to-many relationship to Projects such that one payment (say £10) has two records in Projects allocating the £10 between the projects.Now next month, this...
View Article
More Pages to Explore .....