mySQL select IN range

mysql

Solution

You can't, but you can use `BETWEEN`

SELECT job FROM mytable WHERE id BETWEEN 10 AND 15

Note that `BETWEEN` is inclusive, and will include items with both id 10 and 15.

If you do not want inclusion, you'll have to fall back to using the `>` and `<` operators.

SELECT job FROM mytable WHERE id > 10 AND id < 15

Problem

Is it possible to define a range for the IN part of the query, something like this ``` SELECT job FROM mytable WHERE id IN (10..15); ``` Instead of ``` SELECT job FROM mytable WHERE id IN (10,11,12,13,14,15); ```

Original source