Here is the story
I have two mysql tables:
master
id, descr
1, master 1
2, master 2
the details
id, descr, masterid
1, test 1, 1
2, test 2, 1
3, test 3, 1
4, test 1, 2
5, test 2, 2
6, test 3, 2
I need a query to get the rows from the first table and the looped column from the details
For instance:
first do:
1,master 1, 1
2,master 2, 4
execute the second
1,master 1, 2<- From the details table
2,master 2, 5<- From the details table
third run
1,master 1, 3<- From the details table
2,master 2, 6<- From the details table
Fourth frame:
1,master 1, 1
2,master 2, 4
I think I need to add a column to the main table in order to save the last selected record from the details table, but I cannot design the query.
Any ideas?
Thank. Vangelis