示例:
CREATE TABLE tbl_example
(
column_1 int,
column_2 int,
column_3 int,
column_4 int);
插入值
INSERT ALL
INTO tbl_example (column_1, column_2, column_3, column_4) VALUES (99,10,10,10)
INTO tbl_example (column_1, column_2, column_3, column_4) VALUES (10,99,10,10)
INTO tbl_example (column_1, column_2, column_3, column_4) VALUES (10,10,10,10)
SELECT * FROM dual;
我的查询
SELECT column_1,column_2,column_3
FROM tbl_example where column_1 = '99'
UNION ALL
SELECT column_1,column_2,column_3
FROM tbl_example where column_2 = '99';
我想在不使用过程的情况下优化查询,所以我需要两件事:
这可能吗?