HI, now I have a simple question. This is a simple scenary:
I have a Table "Table1" with three fields (a1, a2, a3). The result of query is a simple row but I need to create this kind of query:
SELECT 'a1' as [Field],
a1 as [Value]
FROM Table1
UNION
SELECT 'a2' as [Field],
a2 as [Value]
FROM Table1
UNION
SELECT 'a3' as [Field],
a3 as [Value]
FROM Table1
The expected result is a table with to fields ("Field" and "Value")
The Problem
...that I have is if I am joining three tables, I need at least 14 fields from this JOIN and I have the Where clause, so I have to repeat each FROM and WHERE clause on each UNION. At the end it is the mother of all queries. Is it possible to create a more simple query for this task?
I need the same result from my initial example for this more complex scenery.
thanks in advance.