Reputation: 5406
Is it possible in MySQL to create records on the fly without first having to create a temporary table and then populate it?
I'm thinking about something like this (syntactically incorrect) example:
SELECT * FROM (`id`, `value`) VALUES
(1, "FOO"),
(2, "BAR");
Upvotes: 1
Views: 62
Reputation: 122032
Yes, you can do it this way -
SELECT 1 id, 'FOO' value
UNION
SELECT 2 id, 'BAR' value
Upvotes: 1