SQL Two Tables with One Unique column
I have two tables tbl_backupchecks and tbl_backupchecks_sqlbak.
Both tables have two column names, Company and ServerName.
I'd like to return a result set comprising of Company and Servername but in a merged list. Essentially if there is a servername and companyname in tbl_backupchecks_SQLBak that is not in tbl_backupchecks I want to report on it as well.
In basic terms I want a resultset of rows that is two column; company and servername. I tried writing a left join but it bought back two columns called ServerName. Can this be done?
Assuming that your columns Company and Servername are datatypes that can be DISTINCT, you could use a UNION query:
SELECT Company, Servername FROM tbl_backupchecks UNION SELECT Company, Servername FROM tbl_backupchecks_sqlbak