$com = $conn->prepare("select * from comments where com_vid_id=? order by likes desc");
在此查询中,如果我的结果是: A,D,C,G,B,K,R,T,Q,Z,V ....
我想得到如下结果: K,R,T,Q,Z,V ....
如何在查询中传递前五个记录?
答案 0 :(得分:2)
使用LIMIT和OFFSET
$com = $conn->prepare("SELECT * FROM comments WHERE com_vid_id=? ORDER BY likes DESC LIMIT 100 OFFSET 5");