日期:2014-05-17  浏览次数:20729 次

求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天