日期:2014-05-17 浏览次数:20796 次
select b.id ,b.name,a.Created from user b , record a
where a.Created between '2013-03-25'and '2013-03-28'
and b.id not in (select userid from a where a.Created between '2013-03-25'and '2013-03-28')
select m.* from
(
select a.dt , b.id from
(
select '2013-03-25' dt union
select '2013-03-26' dt union
select '2013-03-27' dt union
select '2013-03-28'
) a , user b
) m
where not exists(select 1 from Record n where n.UserId = m.id and datediff(dd,n.Created,m.dt) = 0)
ordeer by m.id , m.dt