mysql 1对多--分页查询

时间:2015-01-05 09:28:29   收藏:0   阅读:172

自己记录一下


select p.*,f.* from (select a.id,a.createtime from photo a order BY a.createtime DESC limit 0,10) p INNER join file f on f.photo_id= p.id  order by p.createtime DESC 


注意内部嵌套的那个select 实现的 应该是 查询主表的 十条数据


评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!