I want to add LIMIT clause in postgressql query but its give me error
SELECT complaint_id FROM complaint_details_v2 a where a.road_dept SIMILAR TO 'PWDBnR' order by a.server_time desc LIMIT 0, 10
Below is the error:
ERROR: LIMIT #,# syntax is not supported
SQL state: 42601
Hint: Use separate LIMIT and OFFSET clauses.
Character: 87
For the example above - skip the '0,' bit
SELECT complaint_id FROM complaint_details_v2 a where a.road_dept SIMILAR TO
'PWDBnR' order by a.server_time desc LIMIT 10
LIMIT 0, 10 is not postgres dialect, use OFFSET. For example if you want to next 10 results:
SELECT complaint_id FROM complaint_details_v2 a where a.road_dept SIMILAR TO
'PWDBnR' order by a.server_time desc OFFSET 10 LIMIT 10
http://www.sqlines.com/postgresql/limit_offset
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With