Grouping data in one table based on links in another table
I have something like this:
table1
I开发者_如何学编程D NAME
table2
ID TABLE1_ID NAME VALUE
table3
ID TABLE2_ID COLLECTION
As you may be able to tell, multiple records from table2 can belong to a record in table1. table3 groups together multiple records in table2
It is no problem for me to loop through and display all of the table2 records for a given table1 record. How can I group those records based on table3 though.
May be by:
select * from table2 where id in (select table2_id from table3);
精彩评论