mysql基础⑤

一,order by 与limit查询

 1.价格由高到低排序,降序

select goods_id,goods_name,cat_id,shop_price from goods order by shop_price desc;

2.价格由低到高排序,升序

select goods_id,goods_name,cat_id,shop_price from goods order by shop_price asc;

3.按发布时间由早到晚排序

select goods_id,goods_name,cat_id,shop_price from goods order by goods_id asc;

4.按栏目由低到高排序,栏目内部按价格由高到低排序

select goods_id,goods_name,cat_id,shop_price from goods order by cat_id asc,shop_price desc;

 二where子查询

查询最新的商品,以goods_id为最新

 

posted @ 2016-09-26 21:51  出来混迟早要胖的  阅读(87)  评论(0编辑  收藏  举报