17,086
社区成员
发帖
与我相关
我的任务
分享
CREATE TABLE tb1
(
t_date DATE
);
INSERT INTO tb1 VALUES(to_date('2012-03-06', 'YYYY-MM-DD'));
INSERT INTO tb1 VALUES(to_date('2012-03-07', 'YYYY-MM-DD'));
INSERT INTO tb1 VALUES(to_date('2012-03-08', 'YYYY-MM-DD'));
INSERT INTO tb1 VALUES(to_date('2012-03-09', 'YYYY-MM-DD'));
select sdate from
(select date'2012-03-03'+rownum as sdate from dual
connect by rownum < date'2012-03-11'-date'2012-03-03')
where sdate not in
(select t_date from tb1)
sdate
------------------------
1 2012/3/4
2 2012/3/5
3 2012/3/10
with tb as
(select '2012-3-6' time from dual union all
select '2012-3-7' from dual union all
select '2012-3-8' from dual union all
select '2012-3-9' from dual)
--查询
(select to_date('2012-3-3', 'yyyy-mm-dd')+rownum from dual
connect by rownum<(select to_date('2012-3-11', 'yyyy-mm-dd')-to_date('2012-3-3', 'yyyy-mm-dd')from dual))
minus
(select to_date(time,'yyyy-mm-dd')from tb)
CREATE TABLE T146
(
MyTime DATE
);
INSERT INTO T146 VALUES(to_date('2012-03-06', 'YYYY-MM-DD'));
INSERT INTO T146 VALUES(to_date('2012-03-07', 'YYYY-MM-DD'));
INSERT INTO T146 VALUES(to_date('2012-03-08', 'YYYY-MM-DD'));
INSERT INTO T146 VALUES(to_date('2012-03-09', 'YYYY-MM-DD'));