例如:我现在有这样一个表id          int(10)      主键
goods_id    int(10)      货物id
price       varchar(10)  货物价格
date        varcahr(10)  日期
有下面的数据:
id  goods_id   price      date
1    001       109.7    20100507
2    001       201.6    20100409
3    001       1001.3   20100708要求选出最低价格的那一列,(注意 price 是 varchar 类型)

解决方案 »

  1.   

    select * from 这样一个表 order by price desc limit 1;
      

  2.   

    SoftMingGong (SoftMingGong)
      '截至2010-04-14 18:57:37  用户结帖率0.00% 
    当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
      

  3.   

    要求选出最低价格的那一列,(注意 price 是 varchar 类型)
    如果这样select * from 这样一个表 order by price+0 desc limit 1;
      

  4.   

    相同goods_id中price最低?
    select * from tt a where not exists(select 1 from tt where a.goods_id=goods_id and 0+a.price>0+price)
      

  5.   

    or
    select a.* from tt a inner join
    (select goods_id ,min(0+price) as mi from tt group by goods_id) b
    on a.goods_id=b.goods_id and 0+a.price=b.mi
      

  6.   

    SELECT  id,goods_id,price,date FROM 表  GROUP BY (0+price) LIMIT 1