select companyid,tradeleads=min(tradeleads) from tradeleads group by companyid

解决方案 »

  1.   

    --如果还要显示其他字段
    select a.* 
    from tradeleads a join(
    select companyid,tradeleads=min(tradeleads) from tradeleads group by companyid
    )b on a.tradeleads=b.tradeleads and a.companyid=b.companyid
      

  2.   

    min(tradeleads) 是什么啊,没有tradeleads 这个字段
      

  3.   


    select ta.*
    from tradeleads ta,
    (select max(iden_id) as iden_id from trandeleads group by companyid) as tb
    where ta.iden_id = tb.iden_id假设:iden_id为tradeleads表上唯一的一个流水号