How to retrieve all records after one with an ID in symfony?

后端 未结 2 792
南方客
南方客 2021-01-24 04:40

Let\'s say I have a table that I sort alphabetically in symfony. Each item has a rather random id and I\'d like to retrieve all items after a certain ID. For example:

         


        
2条回答
  •  深忆病人
    2021-01-24 05:00

    SELECT *
    FROM tbl1
    WHERE name > (
      SELECT name
      FROM tbl1
      WHERE id = 3
    )
    ORDER BY name
    

    (runs at least with Postgres and with Just Aguy's SQL Fiddle)

提交回复
热议问题