Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Join question
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

darms21
Yak Posting Veteran

54 Posts

Posted - 03/25/2013 :  12:47:34  Show Profile  Reply with Quote
Greetings,
I have the following tables:
Table A
UUID
Computer_Name

Table B
UUID
ProcedureUUID

Table C
ProcedureUUID
SW_Name

I have the following query which shows me all instances where SoftwareX is install on a system:
SELECT * 
FROM A JOIN B ON A.UUID = B.UUID 
JOIN C ON B.ProcedureUUID= C.ProcedureUUID
WHERE SW_Name like 'SoftwareX'


I would like to be able, in one result set, to identify not only those systems that have SoftwareX installed but also system that do not.

Edited by - darms21 on 03/25/2013 12:49:49

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 03/25/2013 :  13:21:52  Show Profile  Reply with Quote

SELECT * 
FROM A JOIN B ON A.UUID = B.UUID 
LEFT JOIN C ON B.ProcedureUUID= C.ProcedureUUID
AND SW_Name like 'SoftwareX'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

darms21
Yak Posting Veteran

54 Posts

Posted - 03/25/2013 :  15:11:29  Show Profile  Reply with Quote
I appreciate the help but that is not a solution to this query. That does not necessarily identify all records from Table A that may not be in Table B or Table C.

What I have come up w/ however that does appear to work is the following:

SELCT *
(SELECT * 
FROM A JOIN B ON A.UUID = B.UUID 
JOIN C ON B.ProcedureUUID= C.ProcedureUUID
WHERE SW_Name like 'SoftwareX') AS DRV1
RIGHT OUTER JOIN A on DRV1.Name = A.Name
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52326 Posts

Posted - 03/26/2013 :  14:45:59  Show Profile  Reply with Quote

SELECT * 
FROM A LEFT JOIN B ON A.UUID = B.UUID 
LEFT JOIN C ON B.ProcedureUUID= C.ProcedureUUID
AND SW_Name like 'SoftwareX'


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000