[英]Pagination using php and postgresql
我在php文件中有一個postgresql查詢,該查詢返回了一百多個記錄。 我想在使用同一查詢時每頁僅查看10條記錄。 我正在使用的查詢如下:
SELECT
to_char(a.CALLDATE,'yyyymm') AS month,
min(a.calldate) AS start_time,
max(a.calldate) AS end_time,
ceil(sum(a.CALLDURATION::integer) / 60) AS minutes,
count(DISTINCT a.IDENTIFIANT) AS distinct_callers,
a.zoneiddest AS country_code,
b.country
FROM cdr_data a,
COUNTRY_CODES b
WHERE
a.CALLSUBCLASS = '002'
AND
a.CALLCLASS = '008'
AND
a.zoneiddest::integer > 0
AND
substr(a.CALLEDNUMBER, 1, 2) NOT IN ('77', '78', '75', '70', '71', '41', '31', '39', '76','79')
AND
NOT substr(a.zoneiddest , 1 ,3) IN ('254','255','256','211','257','250','256')
AND
trim(a.zoneiddest) = trim(b.country_code)
GROUP BY
to_char(a.CALLDATE,'yyyymm'),
a.zoneiddest,
b.country
ORDER BY 1
我嘗試使用JavaScript,但無法正常工作。 有沒有一種方法可以編輯此查詢或在php中執行某些操作以實現我想要的?
如果有人在那里提供幫助,我將不勝感激,因為如果它與php和mysql分頁,但與php和postgresql無關,那么似乎有很多解決方案。
簡單的解決方案是追加:
OFFSET 20
LIMIT 10
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.