Question

Hi 

 

I have the below data

 

Order--Code--Fulfilled

AAA--123--Yes

BBB--123--Yes

BBB--456--No

CCC--456--Yes

CCC--123--Yes

 

From the above data how can I just get the orders that have been fully fulfilled (BBB has not been fulfilled so should be filtered out)?

 

thanks!

Link to comment
https://www.neowin.net/forum/topic/1332970-sql-query-help/
Share on other sites

8 answers to this question

Recommended Posts

  • 0
4 minutes ago, Slugsie said:

SELECT * FROM <tablename> WHERE Order NOT IN (SELECT Order FROM <tablename> WHERE Fulfilled = 'No')

 

Something along those lines should work.

That will give the same result...

  • 0
3 minutes ago, Slugsie said:

No it won't. Inner query finds all Orders that aren't fulfilled (which will include BBB), then outer query returns any orders that aren't on that list, so BBB will be excluded.

You're right it works!

 

Thanks,

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.