products_ID--category--product_local
1--CORE--0
2--BASE--0
3--BRANCH--1
4--LEAF--3
I need to create a SQL statement that produces all category items where that ROW's products_ID is not found in ANY product_local in the table. So in the table above only the category BASE and LEAF would be printed because their products_ID are not found in any product_local in the table.
TIA as I am completely stuck!Hello newcents,
SELECT *
FROM <tableName>
WHERE products_ID NOT IN
( SELECT DISTINCT product_local
FROM <tableName> )
Enjoy,
No comments:
Post a Comment