use tempdb
declare @list table(zdm varchar(20),kdm varchar(20) ,rq datetime)
insert into @list
select '火箭' , '开拓者' , '2008-10-28 08:00:00.000'
union all select '热火' , '快船' , '2008-10-29 08:30:00.000'
union all select '湖人' , '热火' , '2008-10-29 10:30:00.000'
union all select '火箭' , '雷霆' , '2008-10-30 07:00:00.000'
union all select '开拓者' , '热火' , '2008-10-30 07:30:00.000'
union all select '火箭' , '湖人' , '2008-11-01 08:00:00.000'
union all select '公牛' , '火箭' , '2008-11-03 07:00:00.000'
union all select '火箭' , '太阳' , '2008-11-04 07:30:00.000'
union all select '太阳', '魔术' , '2008-11-05 08:00:00.000'
--select * from @list
select * from @list a
where (zdm='火箭' or kdm='火箭')
and exists(select 1 from @list b
where (zdm='火箭' or kdm='火箭') and abs(datediff(d,a.rq,b.rq))=1)
/*
公牛 火箭 2008-11-03 07:00:00.000
火箭 太阳 2008-11-04 07:30:00.000
*/
中的a和b是什么意思
那这句怎样改写?
我是新手,求多指导