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?

Answers


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

Need Your Help

Ajax CAPTCHA validation

jquery ajax forms security captcha

Is it reasonable (or secure) to validate CAPTCHA via ajax?

Turn off firstboot on centos

centos centos6

Firstboot seems to be running based on this:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.