表A
时间sj 人员name 动作dz2011-1-1 a 考试12011-1-1 b 考试1
2011-1-8 b 考试22011-1-1 c 考试1
2011-1-2 c 考试2我想查出a和b的数据
说明:5日内未考试的数据
时间sj 人员name 动作dz2011-1-1 a 考试12011-1-1 b 考试1
2011-1-8 b 考试22011-1-1 c 考试1
2011-1-2 c 考试2我想查出a和b的数据
说明:5日内未考试的数据
我想查出 以下两条记录:
a
b说明:5日内未参加 考试2 的name
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);
具体格式自己查
sysdate - interval '4' day days 往前4天