Jump to content

Using UNION on two tables with identical columns


Guest sparrez

Recommended Posts

Guest sparrez

HelloI'm trying to join to tables that have the same columns eg.SELECT COL1, COL2, COL3 FROM TBL1UNION ALLSELECT COL1, COL2, COL3 FROM TBL2That works fine, but I would like COL3 from TBL2 to have another name eg. COL4so my result becomesCOL1 | COL2 | COL3 | COL4val |val |NULL |val |val |val |val |NULL |val |val |NULL |val |val |val |val |NULL |and the respective empty rows in COL3 just become NULLHow do I achieve this? tired AS COL4 but that didn't work

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...