日期:2014-05-18 浏览次数:20840 次
create table vacation (id int, uidd int,beginTime datetime, EndTime datetime)
insert into vacation values( 1, 1, '2012-03-29 10:00:00.000','2012-03-29 20:00:00.000')
create table w ( uidd int, score int)
insert into w values( 1, 20)
insert into w values( 2, 20)
insert into w values( 3, 20)
select w.* from w where not exists(select 1 from vacation v where v.uidd = w.uidd and getdate() between v.beginTime and v.EndTime)
drop table vacation , w
/*
uidd score
----------- -----------
1 20
2 20
3 20
(所影响的行数为 3 行)
*/