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?
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 120000MDWP450 Posts
Re: Trying to list orders where a specific part is NOT present2013-04-04T14:53:36ZThis is the accepted answer. This is the accepted answer.Don'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')
mwking 27000167806 Posts
Re: Trying to list orders where a specific part is NOT present2014-09-12T20:10:52ZThis is the accepted answer. This is the accepted answer.
- krmilligan 120000MDWP
Sorry for the long, long delay in responding. Your fix seems to do what I need. Thank you very much.