troubleshooting Question

Get Unique Row satisfying two conditions

Avatar of Shaunsmith
ShaunsmithFlag for United States of America asked on
Oracle DatabaseSQL
8 Comments5 Solutions645 ViewsLast Modified:
I have a Products Table which has a Status column . The Status defines whether the Item is damaged ,repaired,inMaintainance etc

eg:

Prd Id      Status      

1      damaged      
1      Repaired
2      damaged
3      inMaintainance

I was trying to build a query that would give me all the Parts that are damaged but 'not repaired'



select * from products where Status='damaged' And Status not in 'Repaired'


This would give me

Prd Id      Status
1      damaged
2      damaged

But I should not get Product Id =1 as Technically the product has been sent to Repair. The results should be


 Prd Id      Status
2      damaged
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 5 Answers and 8 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 5 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros