I have 3 tables as shown in the screenshot below. I have created a query using UNION as shown below.
SELECT T1_ID AS ID, T1_NAME AS NAME, T1_ADD AS ADDRESS
FROM Table1
UNION
SELECT T2_ID AS ID, T2_NAME AS NAME, T2_ADD AS ADDRESS
FROM Table2
UNION
SELECT T3_ID AS ID, T3_NAME AS NAME, T3_ADD AS ADDRESS
FROM Table3
And I got the result below.
My question is, how do I add a column (field) called TYPE and assign values to the query results but not updating the existing three tables to make it like the screenshot below?
Best Answer
Not the most elegant of solutions, but to answer your question, you could do this: