I am trying to find the rows that all four tables share in common. I tried using this:
SELECT *
FROM TABLE1
INTERSECT
SELECT *
FROM TABLE2
INTERSECT
SELECT *
FROM TABLE3
INTERSECT
SELECT *
FROM TABLE4;
But got no results, i know there are rows that meet this requirement. Because using union instead and adding "order by" i see four rows with the same description from different tables.
Use INNER JOIN
with conditions on the fields that you want
ex:
SELECT
t1.*
FROM
TABLE1 t1
INNER JOIN TABLE2 t2
ON t1.field1 = t2.field1
AND t1.field2 = t2.field2
...
INNER JOIN TABLE2 t3
ON t1.field1 = t3.field1
AND t1.field2 = t3.field2
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With