我试图建设一个简朴的分页,但它好像无法限定功效的数目.
SELECT * FROM visits GROUP by clientID ORDER BY 'date' LIMIT $from,$to
我想只得到每个客户的第一次会见(定时刻次序)并对功效举办分页.
假如我行使$from = 6,$to = 12举办此查询,则返回8行而不是7行.
我做错了什么?
最佳谜底
来自MySQL的LIMIT 条款文档
The LIMIT clause can be used to constrain the number of rows returned by the SELECT statement. LIMIT takes one or two numeric arguments,which must both be nonnegative integer constants (except when using prepared statements).
With two arguments,the first argument specifies the offset of the first row to return,and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1).
当你选择$from 6和$to 12;你不是从6到12选择;你将从$1 = 7开始选择12行.
(编辑:湖南网)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!
|