sql - MSSQL - Compare data from 1 table to multiple tables -


I need to compare a table (which is a CRM inventory) with 4 other tables (which are webserver inventory). Currently I am using the following question, but I am getting duplicate and false positive because of this fact because it checks the first table against each other table and outputs results every time, then they Displays with:

  SELECT SC.Client, ws. [Host header], ws [Ip address], ws [Position] Join fully on sc.Urls = ws. [Host header] WHERE sc.Client IS is tap or Ws [Host header] IS tap or SC Url & lt; & Gt; [Host Header] Select Union Scale Client, WS2 [Host header], ws2. [IP Address], WS2. [Position] Join Fully Skakes. URL = on YS2 [Host header] WHERE sc. Customer Faucet or YS2. [Host header] IS tap or SC Url & lt; & Gt; Ws2 [Host Header] Select Union Scale Client, WS3 [Host header], WS3. [IP address], WS3 [Position] Join Fully Skakes. Url = on ws3 [Host header] WHERE sc Client cord or YS3 [Host header] IS tap or SC Url & lt; & Gt; Ws3 [Host Header] Select Union Scale Client, WS4 [Host header], WS4 [IP address], WS4 Join [States] completely at sc.Urls = ws4 on ws4 [Host header] WHERE sc. Customer Faucet or YS4 [Host header] IS null or scan Url & lt; & Gt; Ws4 [Host header]  

Can anyone tell me in the right direction? I want to return only specific results from each table which are zero or mismatched in sc.Client and ws. [Host header] There is no duplicate between field and 4 webserver tables.

Thanks

This is the first time you have a union between all YS tables Why do not you try to make a complete display of the SC table against the table expression as a result of union operation? - Giorgos Batsus

It was dead! I adjusted my query to the following and did everything well!

  SELECT SC.Client, ws. [Host header], ws [Ip address], ws Join (Select * All * from ws1 union * Select all * from ws2 union * Select all from ws3 union * ws4 *) as sc.Urls = ws. [Host Header]  

Thanks!


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -