我想从使用 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
);
但是出现异常
cx_Oracle.DatabaseError:ORA-00920:无效的关系运算符
就 Oracle 而言,这没问题。但是,查询本身没有多大意义。它等于(在我 friend 的帮助下)
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
所以我建议你改用它。
我是一名优秀的程序员,十分优秀!