SQL查询,不包括前五个记录

时间:2017-06-25 20:08:03

标签: mysql sql

$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 ....

如何在查询中传递前五个记录?

1 个答案:

答案 0 :(得分:2)

使用LIMIT和OFFSET

$com = $conn->prepare("SELECT * FROM comments WHERE com_vid_id=? ORDER BY likes DESC LIMIT 100 OFFSET 5");