(select * from wenzhang where type='置顶')union all select * from (select * from wenzhang where type!='置顶' order by time) as tmp
表结构news: id titlecontenttimeauthordescriptionflagflag作为标记,如果取其中三条数据,则把对应的三条数据的flag设置为1(推荐),默认为0;这样就可以实现取其中的三条数据,剩下的为按时间排序;
取三条:select * from news where flag = 1 limit 3
取剩余的数据select * from news where flag = 0 order by time desc limit 10
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)