码迷,mamicode.com
首页 > 数据库 > 详细

MySQL from型子查询

时间:2015-04-02 19:07:15      阅读:157      评论:0      收藏:0      [点我收藏+]

标签:mysql   sql语句   from型子查询   

    把内层sql语句查询的结果作为临时表供外层sql语句再次查询.

    select goods_id, goods_name from goods where goods_id between 20 and 25;


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


    select goods_id, cat_id, goods_name from (select goods_id, goods_name, cat_id from goods order by cat_id asc, goods_id desc) as tmp group by cat_id;

MySQL from型子查询

标签:mysql   sql语句   from型子查询   

原文地址:http://6562067.blog.51cto.com/6552067/1627776

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!