select ccode(商品编号),fprice(单价),max(ddate(入库日期)),bcheck(审核) from table
group by ccode(商品编号),fprice(单价),bcheck(审核)

解决方案 »

  1.   

    select ccode, fprice from yourtable as A
     where A.ddate = 
      (select max(ddate) from yourtable 
         where ccode = A.ccode 
         and bcheck = '审核')
      

  2.   

    select a.ccode,a.fprice,a.ddate from tabel a inner join
    (select ccode,ddate from table where bcheck =1 group by ccode,ddate )b 
    on a.ccode=b.ccode and a.ddate=b.ddate
      

  3.   

    select * from tablename a
    where exists(
    select * from 
    (
    select ccode,max(ddate) ddate
    from tablename
    where bcheck = '1'
    group by ccode
    ) b
    where a.ccode = b.ccode and a.ddate = b.ddate)
      

  4.   

    select ccode(商品编号),fprice(单价),max(ddate(入库日期)),bcheck(审核) from table
    where bcheck(审核)=1
    group by ccode(商品编号),fprice(单价),bcheck(审核)