An Azure relational database service.
Hi @Mike Kiser ,
While using UNION, INTERSECT or EXCEPT operator, you have to ensure that they have same numbers of columns from different tables.
Suppose MercerReportTableMod has the same column ControlRec , you could refer below:
SELECT ControlRec FROM MercerReportTable
UNION ALL
SELECT ControlRec FROM MercerReportTableMod;
Or you could list all columns and define them as NULL or '' as below:
SELECT ControlRec,NULL col1,NULL col2,NULL col3 FROM MercerReportTable
UNION ALL
SELECT ControlRec,col1,col2,col3 FROM MercerReportTableMod;
Or:
SELECT ControlRec,NULl col1,NULL col2,NULL col3 FROM MercerReportTable
UNION ALL
SELECT NULL ControlRec,col1,col2,col3 FROM MercerReportTableMod;
If above are not working,we recommend that you post CREATE TABLE statements for your tables together with INSERT statements with sample data, enough to illustrate all angles of the problem. We also need to see the expected result of the sample.
Best regards
Melissa
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.