对于跨表的 SQL 查询,我真的很感激。我意识到这种事情经常被问到,但我找不到足够相似的问题来理解答案。
我想从中选择table_A
具有相应标记的行table_B
。
因此,例如,“选择table_a
标记为 'chair' 的行”将返回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
或者,有没有更好的方法来组织数据?