Fairly new to SQLand need some help.
Using a typical Order Header table and Order Detail table that are linked by Order number. I need to identify orders where the part # = 'LABOR' is not present.
Is there an SQL construct that will allow me to come up with an answer set of the Orders that do not contain the part 'LABOR' in 1 pass, or will I have to do 2 or more passes?
This topic has been locked.
2 replies Latest Post - 2014-09-12T20:10:52Z by mwking
Pinned topic Trying to list orders where a specific part is NOT present
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2013-04-04T14:53:36Z at 2013-04-04T14:53:36Z by krmilligan
krmilligan 120000MDWP433 PostsACCEPTED ANSWER
Re: Trying to list orders where a specific part is NOT present2013-04-04T14:53:36Z in response to mwkingDon't fully understand your database, but how about something like the following:
SELECT ordnum FROM ordhdr
WHERE ordnum NOT IN (SELECT DISTINCT ordnum FROM orddtl WHERE part#='LABOR')