mysql select lowest price from multi select

后端 未结 4 1358
孤独总比滥情好
孤独总比滥情好 2021-01-25 08:11

TABLE price

user_id    b01    b02    b03    b04    b05    b06    b07    b08    b09
MP01       21     32     12     34     56     26     21     21     26    
MO11         


        
4条回答
  •  攒了一身酷
    2021-01-25 08:34

    you can use the LEAST function, as in:

    select least(b01,b02,b03,b04,b05,b06,b07,b08,b09) from price where user_id = 'MP01'

    http://dev.mysql.com/doc/refman/5.0/en/comparison-operators.html#function_least

提交回复
热议问题