Suppose we have the following table:
CREATE TABLE a (
    id int primary key,
    from int, 
    to int
);
INSERT INTO a (id, from, to) VALUES (1, 1, 3);
INSERT INTO a (id, from, to) VALUES (2, 1, 2);
INSERT INTO a (id, from, to) VALUES (3, 2, 4);
I need to write a query, that will return:
+------------+---------+
|    id      |  value  |
+------------+---------+
|     1      |   1     |
|     1      |   2     |
|     1      |   3     |
|            |         |
|     2      |   1     |
|     2      |   2     |
|            |         |
|     3      |   2     |
|     3      |   3     |
|     3      |   4     |
+------------+---------+
The first column is id itself. The second column should contain all values between from and to, with step 1 between values.
 
    