select * from 表名 where (time=(select max(time) from 表名))

解决方案 »

  1.   

    我的sql语句如下,执行没问题,就是速度太慢,这个表有100多万条
    select b.product,b.vendor,a.price 
        from
            (select product,vendor,max(time) as lastdate from table1
                 where time < = '20021218'
                 group by product, vendor
            ) b,
            table1 a
        where b.product = a.product
              and b.vendor = a.vendor
              and b.lastdate = a.time