[英]query to find out the matched records of two tables with the same column names
See these two sample tables: 请参阅以下两个示例表:
Table 1: 表格1:
id volume price total
1 A B C
2 D E F
3 G H I
Table 2: 表2:
id volume price total
1 A B C
2 G H I
3 D E F
I want the output which are equal from table1 and table2. 我想要等于table1和table2的输出。 I have tried many ways but no results.
我尝试了很多方法,但没有结果。
output should be like this: 输出应该是这样的:
id volume price total
1 G H I
2 D E F
SELECT with inner join should work. 具有内部联接的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.
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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.