开发者

Grouping data in one table based on links in another table

开发者 https://www.devze.com 2023-02-27 19:15 出处:网络
I have something like this: table1 I开发者_如何学编程DNAME table2 IDTABLE1_IDNAMEVALUE table3 IDTABLE2_IDCOLLECTION

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);
0

精彩评论

暂无评论...
验证码 换一张
取 消