SELECT ABS(id-8),* FROM article ORDER BY 1 LIMIT 4
原理,使用id与指定值之差的绝对值作为排序项目,能按照接近程度查询数据,使用LIMIT限制结果数量。
select * from order where id in (select order_id from EditOrder)SELECT id, name, (SELECT comment_id, title, content FROM B WHERE user_id = A.id ORDER BY create_time DESC LIMIT 1) FROM A欢迎分享,转载请注明来源:内存溢出
评论列表(0条)