Skip to content
Christoph Herrmann edited this page Oct 17, 2019 · 3 revisions
const offset = 20

const result = await sql.query(sql`
  SELECT * FROM users LIMIT 5 ${sql.offset(offset)}
`)

// text: SELECT * FROM users LIMIT 5 OFFSET 20
// values: []

The offset is dedicated validated and set into the text without parameter placeholder, because a placeholder don't care about the number is negative or positive and a negative number for the offset would result in a SQL error.

Clone this wiki locally