Solved Combination Criteria (1 Viewer)

samthomasny

New member
Local time
Today, 10:01
Joined
Aug 27, 2014
Messages
3
Can someone please help me on this? In the below screenshot I want the sql qry to return only 'Ord3'
Ord1 must be excluded because of 'FC' (easy <> "FC")
Ord2 must be excluded because one of those records have 'FC' (struggling)
Ord3 must be included since it doesnt have any 'FC' records

Right now "AP" Or "PO" And Not like "FC*" is returning me both Ord2 & Ord3
1678294598516.png
 
Last edited:

pbaldy

Wino Moderator
Staff member
Local time
Today, 07:01
Joined
Aug 30, 2003
Messages
36,126
My first thought is 2 queries. The first finds all orders with a value of FC. Then use the unmatched query wizard with the original data compared to that query to find all those that don't have an FC.
 

June7

AWF VIP
Local time
Today, 06:01
Joined
Mar 9, 2014
Messages
5,474
SELECT * FROM table WHERE NOT Ords IN (SELECT Ords FROM table WHERE Holds = 'FC')
 

June7

AWF VIP
Local time
Today, 06:01
Joined
Mar 9, 2014
Messages
5,474
WHERE (((GTORHD.HORSTS)<>"C") AND ((GTORDT3.DSTATS)<>"C")) AND NOT GTSUSH.[UORD#] IN (SELECT [UORD#] FROM GTSUSH WHERE USUSCD='FC')
 

samthomasny

New member
Local time
Today, 10:01
Joined
Aug 27, 2014
Messages
3
WHERE (((GTORHD.HORSTS)<>"C") AND ((GTORDT3.DSTATS)<>"C")) AND NOT GTSUSH.[UORD#] IN (SELECT [UORD#] FROM GTSUSH WHERE USUSCD='FC')
Worked perfect. Learned something new today. Thanks a lot.
 

Users who are viewing this thread

Top Bottom