【发布时间】:2011-03-27 02:15:10
【问题描述】:
非常感谢有关跨表的 SQL 查询的帮助。我意识到这种事情经常被问到,但我找不到足够相似的问题来理解答案。
我想从table_A 中选择在table_B 中有相应标记的行。
因此,例如,“从table_a 中选择标记为‘椅子’的行”将返回table_C。
另外,id 在table_a 中是唯一的,而不是在table_b 中。
table_A: table_B: table_C:
id object id tag id object
1 lamp 1 furniture 3 stool
2 table 2 furniture 4 bench
3 stool 3 furniture
4 bench 4 furniture
4 chair
3 chair
或者,有没有更好的方法来组织数据?
【问题讨论】:
标签: sql multiple-tables