select * from tablename a where 报价日期 =(select max(报价日期) from tablename where 公司名称=a.公司名称)

解决方案 »

  1.   

    select * from tablename a where 报价日期 =(select max(报价日期) from tablename where 公司名称=a.公司名称)
      

  2.   

    SELECT * FROM 表 A WHERE 报价日期 =(SELECT MAX(报价日期) FROM 表
    WHERE 公司名称 = A.公司名称)
      

  3.   

    select * from 表 aa where not exists(select 1 form 表 bb where aa.公司名称=bb.公司名称 and aa.报价日期<bb.报价日期)
      

  4.   

    select * from 你的表 a 
    where 报价日期 =(select max(报价日期) from 你的表 where 公司名称=a.公司名称)
      

  5.   

    select * from table1 A
    where 报价日期 = (select max(报价日期) from table1 where 公司名称  = A.公司名称)
      

  6.   

    select * from 原表 a
    inner join 
    (select 公司名称,max(报价日期) as 报价日期 from 原表
    group by 公司名称) b
    on a.公司名称=b.公司名称 and a.报价日期=b.报价日期
      

  7.   

    select * from tablename where 公司名称 in (select 公司名称,max(报价日期) from tablename group by 公司名称)
      

  8.   

    select * from tablename a where 报价日期 > any (select 报价日期 from tablename where 公司名称=a.公司名称)
    union
    select * from tablename  where 公司名称 in (select 公司名称 from tablename group by 公司名称 having count(公司名称)=1)
    or
    select * from tablename a where 报价日期 in (select max(报价日期) from tablename where 公司名称=a.公司名称)
      

  9.   

    select * from tablename a where 报价日期 =(select max(报价日期) from tablename where 公司名称=a.公司名称)
      

  10.   

    如果报价日期唯一的话可以直接:select * from 表名 where 报价日期 in (select max(报价日期) from 表名 group by 公司名称)
      

  11.   

    select * from tablename where 报价日期 in(select max(报价日期) from tablename group by 公司名称)