johnnyg24 Posted April 23, 2015 Share Posted April 23, 2015 I'm looking for a way to exclude all related records if one column has a particular value. Here is an example: ID | BOOK A | 1234 A | 5678 A | 9101 B | 5678 B | 9101 C | 5678 if BOOK = '1234' then exclude all ID = 'A'. My desired output would be: ID | BOOK B | 5678 B | 9101 C | 5678 Is there a way to do this? -Thanks Link to comment Share on other sites More sharing options...
justsomeguy Posted April 23, 2015 Share Posted April 23, 2015 You could use a subquery. SELECT * FROM table WHERE id NOT IN (SELECT id FROM table WHERE book = 1234) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now