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

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to merge these two?

Author  Topic 

hh1234
Starting Member

30 Posts

Posted - 2011-10-17 : 16:02:52
Hi, I am new to SQL and still struggle with basic syntax etc....

I have this SCCM SQL report that works.

SELECT DISTINCT a.Name0 AS [Machine Name],
b.SiteCode,c.FileVersion AS [IE Version],
d.Operating_System_Name_and0,
c.FilePath
FROM v_GS_SoftwareFile c INNER JOIN
v_GS_SYSTEM a ON c.ResourceID = a.ResourceID INNER JOIN
v_R_System d ON a.ResourceID = d.ResourceID INNER JOIN
v_FullCollectionMembership b ON a.ResourceID = b.ResourceID
WHERE (c.FileName = 'iexplore.exe') AND (c.FileVersion like '6.%')
ORDER BY a.Name0


Then, from a different SCCM Report I saw this logic, that returns the Assigned SCCM Site Code

Sys.AD_SITE_NAME0 as 'Location', dbo.v_RA_System_SMSAssignedSites.SMS_Assigned_Sites0

INNER JOIN dbo.v_RA_System_SMSAssignedSites ON SYS.ResourceID = dbo.v_RA_System_SMSAssignedSites.ResourceID


No matter what I try when I merge the two it fails. The SCCM report won't even close/compile.

How do I add the SITE CODE information to my working code?

Thank you.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-18 : 00:41:30
the second query is not complete
for example i cant see the from part also i feel some columns are missing
Post the complete query and then we will help you out in merging

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

Go to Top of Page

hh1234
Starting Member

30 Posts

Posted - 2011-10-18 : 09:52:59
Thanks. I guess my question is how do I add Site Code to the first part of my code? I need to have the first part get the site code and display it when run.

Thanks.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-18 : 10:10:36
[code]
SELECT DISTINCT a.Name0 AS [Machine Name],
b.SiteCode,c.FileVersion AS [IE Version],
d.Operating_System_Name_and0,
c.FilePath,
dbo.v_RA_System_SMSAssignedSites.SMS_Assigned_Sites0
FROM v_GS_SoftwareFile c INNER JOIN
v_GS_SYSTEM a ON c.ResourceID = a.ResourceID INNER JOIN
v_R_System d ON a.ResourceID = d.ResourceID INNER JOIN
v_FullCollectionMembership b ON a.ResourceID = b.ResourceID
INNER JOIN dbo.v_RA_System_SMSAssignedSites ON a.ResourceID = dbo.v_RA_System_SMSAssignedSites.ResourceID
WHERE (c.FileName = 'iexplore.exe') AND (c.FileVersion like '6.%')
ORDER BY a.Name0
[/code]

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

Go to Top of Page

hh1234
Starting Member

30 Posts

Posted - 2011-10-18 : 13:25:00
Cool, that worked. thank you.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-10-19 : 04:31:14
wc

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

Go to Top of Page
   

- Advertisement -