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
 Another Merge Question

Author  Topic 

hh1234
Starting Member

30 Posts

Posted - 2011-10-19 : 13:36:42
I am still struggling with merging different SQL statements.

How would I merge these two SCCM reports. Each runs fine when run on its own.

SELECT Sys.Netbios_Name0,MAC.MAC_Addresses0, IP.IP_Addresses0
FROM v_R_System Sys, v_RA_System_MACAddresses MAC, v_RA_System_IPAddresses IP
WHERE Sys.ResourceID = MAC.ResourceID AND Sys.ResourceID = IP.ResourceID AND
MAC.MAC_Addresses0 LIKE @variable
ORDER BY MAC.MAC_Addresses0

------------------------------------------------------

SELECT
v_Advertisement.AdvertisementName,
v_Advertisement.Comment,
v_Package.Name AS TaskSequenceName,
v_Advertisement.SourceSite,
CASE WHEN AssignedScheduleEnabled != 0 OR (AdvertFlags & 0x720) != 0
THEN '*'
ELSE ''
END AS C063,
v_Collection.Name as C064,
CASE IncludeSubCollection
WHEN 1 THEN '*'
WHEN 0 THEN ''
END AS C065,
AdvertisementID
FROM v_Advertisement
INNER JOIN v_Package ON v_Advertisement.PackageID = v_Package.PackageID
INNER JOIN v_Collection ON v_Advertisement.CollectionID = v_Collection.CollectionID
WHERE v_Package.ImageFlags = 0x4
ORDER BY v_Advertisement.AdvertisementName

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2011-10-19 : 13:54:58
Merge how? I'm assuming you cannot just do a UNION.. but I (we) need more to go on.

Maybe this link will help you pull all the bits together so we can help you better:
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

hh1234
Starting Member

30 Posts

Posted - 2011-10-19 : 15:31:32
Thank you. What I really need is the add this to the 2nd script

Sys.ResourceID = MAC.ResourceID AND Sys.ResourceID = IP.ResourceID AND
MAC.MAC_Addresses0 LIKE @variable

We need to find out the Mac Address that Advertisements and Packages were deployed too.

Thank you.
Go to Top of Page
   

- Advertisement -