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'
)

解决方案 »

  1.   

    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'
    )--这个有什么问题??你想怎样修改??
      

  2.   

    select a.*
    from View_ToExcel a
    join 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'
      

  3.   

    多谢大家!多谢josy
    !!!