我有五张桌子:
在这些表中,字段很常见,即name
。
SELECT *
FROM table1, table2, table3, table4, table5
WHERE table1.name = table2.name
and table2.name = table3.name
and table3.name = table4.name
and table4.name = table5.name
此类查询是否有效?
答案 0 :(得分:0)
试试这个例子并根据自己的喜好进行调整。
SELECT T1.*, T2.*, T3.*, T4.*, T5.*
FROM TABLE1 T1
JOIN TABLE2 T2 ON T1.NAME = T2.NAME
JOIN TABLE2 T3 ON T1.NAME = T3.NAME
JOIN TABLE2 T4 ON T1.NAME = T4.NAME
JOIN TABLE2 T5 ON T1.NAME = T5.NAME