请参阅以下两个示例表:
表1:
id volume price total
1 A B C
2 D E F
3 G H I
表2:
id volume price total
1 A B C
2 G H I
3 D E F
我想要与table1和table2相等的输出。我尝试了很多方法,但没有结果。
输出应如下所示:
id volume price total
1 G H I
2 D E F
答案 0 :(得分:0)
具有内部联接的SELECT应该起作用。
SELECT
table1.id,
table1.volume,
table1.price,
table1.total
FROM table1
INNER JOIN table2
ON table1.volume = table2.volume
AND table1.price = table2.price
AND table1.totak = table2.price.
答案 1 :(得分:0)
SELECT * FROM table1 AS T1 INNER JOIN table 2 AS T2 WHERE T1.volume=T2.volume AND T1.price=T2.price AND T1.total=T2.total