select top 1 aa,bb,cc,dd from 表 where bb=1 and aa in (select cc from 表 )
你的意思不大懂

解决方案 »

  1.   

    select aa, bb, cc, max(dd)
    from a
    where bb = 1
    group by aa, cc
      

  2.   

    select distinct aa,cc from yourtable where bb=1
      

  3.   

    select * from yourtable as A 
     where bb = 1 and dd = 
      (select top 1 dd from yourtable where aa = A.aa and cc = A.cc and bb = 1)
      

  4.   

    To dlkfth(流氓兔) 
      不是这样的,先是要过滤出bb=1地记录,然后把相同aa的记录选出来,
    再在里面选出相同bb地记录,只显示其中一条记录出来。
      

  5.   

    select aa, bb, cc, max(dd)
    from a
    where bb = 1
    group by aa, cc,bb
      

  6.   

    To All:
    你们的方法都不行“因为该列既不包含在聚合函数中,也不包含在 GROUP BY 子句中。”
    为什么要将select 里的所有字段都写道Group by 语句里?