What is the SQL for 'next' and 'previous' in a table?

后端 未结 7 868
抹茶落季
抹茶落季 2020-12-05 12:21

I have a table of items, each of which has a date associated with it. If I have the date associated with one item, how do I query the database with SQL to get the \'previous

7条回答
  •  抹茶落季
    2020-12-05 12:46

    Select max(element) From Data Where Element < 8

    Union

    Select min(element) From Data Where Element > 8

    But generally it is more usefull to think of sql for set oriented operations rather than iterative operation.

提交回复
热议问题