I don't know how to do this and have trouble explaining it:)
Posted: Mon Apr 16, 2007 10:59 am
Anyone suggest an effecient way to do this - I'm not sure what I'm supposed to try next:
I have a query that looks more or less like:
SELECT * FROM mytable WHERE primary_id IN ('3,4,7')
this select is generated from a select and the 3, 4 and 7 are generated dynamically based on the actual ids chose from the select list. Anyhow, I then query all the other tables based on this id as the foreign key.
Now here is the problem, how the heck do I display this data.
I know I can just loop through to show the contents of the query for "mytable" but I want to display the data like this:
mydata->name1
othertable->info1
othertable->info2
othertable->info3
mydata->name2
othertable->info1
othertable->info2
othertable->info3
So I want to display the title for example from my main table and then all the detail info from the other tables. This would be straight forward with a single query but since I have queried as above, I really don't know what I'm supposed to do to match the data properly
Can anyone help....
I have a query that looks more or less like:
SELECT * FROM mytable WHERE primary_id IN ('3,4,7')
this select is generated from a select and the 3, 4 and 7 are generated dynamically based on the actual ids chose from the select list. Anyhow, I then query all the other tables based on this id as the foreign key.
Now here is the problem, how the heck do I display this data.
I know I can just loop through to show the contents of the query for "mytable" but I want to display the data like this:
mydata->name1
othertable->info1
othertable->info2
othertable->info3
mydata->name2
othertable->info1
othertable->info2
othertable->info3
So I want to display the title for example from my main table and then all the detail info from the other tables. This would be straight forward with a single query but since I have queried as above, I really don't know what I'm supposed to do to match the data properly
Can anyone help....