TABLE A
ID Name Age
1 John 22
TABLE B
ID Name
5 Erik
I want result like
ID Name Age
1 John 22
5 Erik
When I am performing UNION giving error
"All queries combined using a UNION, INTERSECT or EXCEPT operator must have an equal number of expressions in their target lists."
How to get desired result?
You could supply a dummy column in lieu of the missing one that returns NULL
as below.
SELECT ID,
Name,
Age
FROM TABLE_A
UNION ALL
SELECT ID,
Name,
NULL
FROM TABLE_B
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With