先用distinct选择出符合条件的数据,然后根据该表的主键查询出image的数据

解决方案 »

  1.   

    select distinct(a) ,b from bug_patch
    这里b为image
    主建为c该怎么写?
      

  2.   

    select b from bug_patch where c = :参数
      

  3.   

    select distinct(a) into #temp from bug_patchselect #temp.a,  bug_patch.b
    from  #temp , bug_patch
    where #temp.a = bug_patch.a
      

  4.   

    declare @value
    select distinct a,@value = c  from bug_patch;
    select b from bug_patch where c = @value;
      

  5.   

    select a,b from bug_patch where id in (select max(id) from bug_patch group by b)  --id primary key
      

  6.   

    select a,b from bug_patch b where exists(select * from bug_patch where a=b.a and c>b.c)