SQL: Select a list of numbers from “nothing”

后端 未结 4 1247
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-02 01:24

What is a fast/readable way to SELECT a relation from \"nothing\" that contains a list of numbers. I want to define which numbers by setting a start and end value. I am usi

4条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-02 02:08

    Some other alternative (tried in postgres, but should be working with others)

    select (0) as count union values (1),(2),(3),(4),(5)

    Extending this sql with code will be straight forward.

提交回复
热议问题