What is the standard SQL Query to retrieve the intersection of tables?

前端 未结 9 596
谎友^
谎友^ 2021-02-02 03:57

Selecting the union:

select * from table1 
union 
select * from table1_backup 

What is the query to select the intersection?

9条回答
  •  北荒
    北荒 (楼主)
    2021-02-02 04:36

    subqueries?! really?

    to get the intersection of table1 and table2:

    SELECT * FROM table1, table2 WHERE table1.pk=table2.pk;
    

提交回复
热议问题