读书人

求5天后是否产生数据的sql。该如何解决

发布时间: 2012-04-23 13:17:38 作者: rapoo

求5天后是否产生数据的sql。。。
表A
时间sj 人员name 动作dz

2011-1-1 a 考试1

2011-1-1 b 考试1
2011-1-8 b 考试2

2011-1-1 c 考试1
2011-1-2 c 考试2





我想查出a和b的数据
说明:5日内未考试的数据

[解决办法]
更正下:
select distinct t1.name from a t1 where not exists (select 1 from a t2 where t2.name = t1.name and t2.dz = ' 考试2' and t2.sj between 时间1 and 时间2);
[解决办法]
主要在where中between 今天 and 今天+5
具体格式自己查
[解决办法]
sysdate 当天
sysdate - interval '4' day days 往前4天

读书人网 >oracle

热点推荐