Search code examples
sqlsqliteselectintersect

How can do subscription between two SELECT set?


SELECT field1
FROM tbl1
WHERE conditionsx

...?

SELECT field2
FROM tbl2
WHERE conditionsy

I Want return same below↓ What is superscription between two SELECT results.

enter image description here


Solution

  • You can use the INTERSECT operator:

    SELECT field1 FROM tbl1 WHERE conditionsx
    INTERSECT
    SELECT field2 FROM tbl2 WHERE conditionsy