troubleshooting Question

Oracle SQL

Avatar of smalig
smalig asked on
Oracle Database
16 Comments2 Solutions59 ViewsLast Modified:
Experts -
I have a table with 3 attributes -- ID, NBR and CODE.
values in the table will be

ID                            NBR                          CODE
43247                     46064                       Red
52395                     52268                      Green
52760                     52268                      Green
49025                     52852                      Green
49025                     52852                      Red
49025                     52852                      Yellow
51681                     72523                      Green
45202                     131179                     Yellow
13127                     440587                       Yellow
13128                    440587                     Green

Can I have a query where the output is chosen depending on the code for the unique combination of ID and NBR
the order of CODE is Red, Yellow and Green

ex: for NBR of 52852  I have all 3 CODE's i.e. Red, Yellow and Green. the output should be of the record Red only
Similarly for 440587 I have 2 CODE's i.e. Yellow and Green. the output should be of the record Yellow only

If there are multiple Red's, Yellow's or Green's only one record can be shown (not all is needed in the output)
Thanks for your help
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 2 Answers and 16 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 2 Answers and 16 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