Creating a multi-row "table" as part of a SELECT

Posted by Chad Birch on Stack Overflow See other posts from Stack Overflow or by Chad Birch
Published on 2010-04-05T20:38:43Z Indexed on 2010/04/05 20:43 UTC
Read the original article Hit count: 154

Filed under:
|

I'm not really sure how to describe my question (thus the awful title), but it's related to this recent question.

The problem would be easily solved if there was some way for me to create a "table" with 4 rows as part of my SELECT (to use with NOT IN or MINUS).

What I mean is, I can do this:

SELECT 1, 2, 3, 4;

And will receive one row from the database:

| 1 | 2 | 3 | 4 |

But is there any way to receive the following (without using UNION, I don't really want a query that's potentially thousands of lines long with a long list)?

| 1 |
| 2 |
| 3 |
| 4 |

© Stack Overflow or respective owner

Related posts about sql

Related posts about mysql