I have two tables that I need to compare to find records that are not in one table. My SQL so far is,
SELECT ORD_NAME FROM ERP_IMPORT_COMP
EXCEPT
SELECT NAME FROM OR_ORDER
This returns the ORD_NAME's of the records I want, but I would like to select all the fields in ERP_IMPORT_COMP WHERE they don't exist in OR_ORDER, matching by ORD_NAME=NAME. Is that possible?
Thanks.
2条答案
按热度按时间vs3odd8k1#
This looks like you need to use not exists
bweufnob2#
This is a classic case for a
left join