0

OFFSET is not working

SELECT
  iContentID,
  vTitle,
  vContectNo
FROM
  `tbl_contact_list`
WHERE
  `eStatus` = Active AND `eDeleted` = 0
ORDER BY
  `vTitle` ASC OFFSET 0

Getting below error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'offset 0' at line 1

phpmyadmin Version information: 4.0.10deb1
database Server version: 5.5.54-0ubuntu0.14.04.1 - (Ubuntu)
PHP version 7
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
Pathik Vejani
  • 4,263
  • 8
  • 57
  • 98

1 Answers1

3

Looking at the syntax for SELECT:

[LIMIT {[offset,] row_count | row_count OFFSET offset}]

You need a LIMIT first to specify the maximum number of rows to return.

See also this question for more details on usage.

(BTW, OFFSET 0 is unnecessary as it is the default)

Ken Y-N
  • 14,644
  • 21
  • 71
  • 114