I am trying to use a clause EXCEPT
to retrieve data from a table. I want to get all rows from table1
except those that exist in table2
. As far as I understand, the following will not work:
CREATE TABLE table1(pk_id int, fk_id_tbl2 int);
CREATE TABLE table2(pk_id int);
Select fk_id_tbl2
FROM table1
Except
Select pk_id
FROM table2
The only way I can use EXCEPT
is to select from the same tables or select columns with the same column name from different tables.
Can someone explain how to use the explanation clause better?
source
share