I have searched on the forums and failed to find how can one name columns for a values statement subquery.
Here is my query in MySQL:
SELECT *
FROM (VALUES
('PPA', 'blah', 30)
, ('PPB', 'blah blah', 60)
) AS X
Here is what I can do in T-SQL:
SELECT x.a, x.b, x.c
FROM (VALUES
('PPA', 'blah', 30)
, ('PPB', 'blah blah', 60)
) AS x(a, b, c)
Very simple, yet can’t find out.
Note: As I know this query can be simplified to no subquery, my question remains as this will be merged into another query for an insert and a left join of mine.
3
Answers
From what I could find further on looking at MariaDB, you could use common table expressions as such:
from source
You are almost there just need to add ROW.
Result:
More about ROW you can read here and here.
You could use a union as well