Reputation: 105
I want to select from table where multiple columns selected from sub query using WHERE (COLUMN1, COLUMN2, COLUMN3) IN (SUB QUERY)
SELECT * FROM ORDER_DETAIL
WHERE (ORDER_ID, ACTION_SEQUENCE, DETAIL_SEQUENCE)
IN (
SELECT ORDER_ID, ACTION_SEQUENCE, DETAIL_SEQUENCE
FROM ORDER_DETAIL
WHERE ORDER_ID=314239027
);
But an exception raises
cx_Oracle.DatabaseError: ORA-00920: invalid relational operator
Upvotes: 1
Views: 426
Reputation: 143103
As far as Oracle is concerned, that's OK. But, the query itself doesn't have much sense. It is equal to (with the help of my friends)
select *
from order_detail
where order_id = 314239027
and action_sequence is not null -- if those columns ...
and detail_sequence is not null -- ... can contain nulls
so I suggest you use it instead.
Upvotes: 0