select *from dbo.View_ToExcel
where
时间>='2012-01-01'
and
时间<='2012-01-31'
and
姓名 in
(
select 姓名 from View_ToExcel
where
时间>='2011-12-01'
and
时间<='2011-12-31'
)
------解决方案--------------------
- SQL code
select a.*from View_ToExcel ajoin View_ToExcel b on a.姓名=b.姓名where a.时间>='2012-01-01' and a.时间<='2012-01-31'and b.时间>='2011-12-01' and b.时间<='2011-12-31'
------解决方案--------------------