I'm an Oracle beginner and I'm having troubleshooting the issue below.
My table:
+-------+------+-------+------ +
| ID | GRP | ITDESC| DEN |
+-------+------+-------+------ +
| 12345 | MANX | Apple | SendV |
+-------+------+-------+------ +
| 12345 | MANX | Apple | Manual|
+-------+------+-------+-------
| 12345 | MANX | Apple | UnVeri|
+-------+------+-------+------ +
| 12346 | MANX | Mango | UnVeri|
+-------+------+-------+------ +
| 12347 | MANX | PineAp| SendV|
+-------+------+-------+------ +
12348 | MANX | Pine | Manual|
I am expecting:
+-------+------+-------+------ +
| ID | GRP | ITDESC| DEN |
+-------+------+-------+------ +
| 12345 | MANX | Apple | SendV |
+-------+------+-------+------ +
| 12346 | MANX | Mango | UnVeri|
+-------+------+-------+------ +
| 12347 | MANX | PineAp| SendV|
+-------+------+-------+------ +
| 12348 | MANX | Pine | Manual|
+-------+------+-------+------ +
I have multiple rows that have only the DEN column different for the same id. My aim is for the same id perform the check. If the value of DEN is 'Manual' then check to see if there is 'SendV' in DEN column for that id. If it is present then consider 'SendV' otherwise consider 'Manual'.
Note in the provided example, the order is random. The SendV can be in 2nd row or 3rd row or 4th row based on the action, however the text of DEN will be same as said above.
select * from table t1 where DEN IN ('Manual', 'SendV')
.
I am not aware how to write the condition?
Best Answer
So what happens then there is no row with
Manual
, but there is withSendV
? Should it beSendV
as in your example output?