mysql -标量子查询-案例
时间:2020-07-01 12:14:56
收藏:0
阅读:78
把价格最高的商品取出来???
select * from goods order by goods_price desc limit 1;
可是价格最高的可能有很多条数据呢?
所以,换一种方式
1,查出最高的价格
select max(goods_price) from goods;
2,根据最高价查询
select * from goods where goods_price = (select max(goods_price) from goods);
评论(0)