【发布时间】:2020-11-11 21:11:47
【问题描述】:
如果我的INPUT DATA如下图:
id1Number id2String id3String blob1 blob2 last_updated_timestamp
----------------------------------------------------------------------------------
1 1-1 11-11 ... 2020/01/01
2 2-1 22-11 ... ... 2020/01/02
3 3-1 ... 2020/01/01
4 4-1 44-11 ... 2020/01/05
5 5-1 55-11 2020/01/01
6 6-1 66-11 ... 2020/02/02
7 7-1 77-11 ... 2020/02/03
预期输出 我想编写一个 Query3,它将 Query1 和 Query2 的结果组合在一个查询中,并将得到如下所示的输出
select id1Number, id2String, id3String
from table
where ...
id1Number id2String id3String
-------------------------------
1 1-1
4 44-11
5 5-1 55-11
查询1
select id1Number, id2String
from table
where blob1 is NULL and
last_updated_timestamp >= to_timestamp('2020-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') and
last_updated_timestamp < to_timestamp('2020-02-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS');
id1Number id2String
-------------------
1 1-1
5 5-1
查询2
select id1Number, id3String
from table
where blob2 is NULL and
id3String is NOT NULL and
last_updated_timestamp >= to_timestamp('2020-01-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS') and
last_updated_timestamp < to_timestamp('2020-02-01 00:00:00', 'YYYY-MM-DD HH24:MI:SS');
id1Number id3String
-------------------
4 44-11
5 55-11
【问题讨论】:
标签: sql oracle plsql where-clause