I have three columns
Field A = A,B,C
Field B = D,E,F
Field C = G,H,I
How can I combine them into one single row WITHOUT using "union all"?
Like this:
select Field A as 1 from TableZ
union all
select Field B as 1 from TableZ
union all
select Field C as 1 from TableZ
The reason I do not want to use a union is because the real query I am making is big, so I don't want to repeat the code 3 times. Important to say is that I do not wish to concat the three columns, I just want to add them in single row.
If you don't want to repeat your query - use Common Table Expressions, commonly known as CTE.
Here is an example: