Quantcast
Viewing all articles
Browse latest Browse all 2021

Report - join sql querys

I need a solution

Hi, I am just learning sql I have the following 2 querys that I want to combine, they both give part of the results I need but in separate reports

The brief from the client is to create a report on the following for a future outlook rollout we will be doing:

  • Computer Name
  • User
  • MOEversion (this is a dataclass we've created) 
  • Office version
  • IE version
  • Managed/Unmanaged

first report - which I have created with the query builder but can convert to sql

DECLARE @v1_TrusteeScope nvarchar(max)
   SET @v1_TrusteeScope = N'%TrusteeScope%'
SELECT
   [vri2_Computer].[Guid] AS [_ItemGuid],
   [vri2_Computer].[Name],
   [dca4_MOEVersion].[MOEVersion],
   [dca3_AeX AC Identification].[Last Logon User],
   [vri2_Computer].[IsManaged]
FROM
   [vRM_Computer_Item] AS [vri2_Computer]
      LEFT OUTER JOIN [Inv_AeX_AC_Identification] AS [dca3_AeX AC Identification]
         ON ([vri2_Computer].[Guid] = [dca3_AeX AC Identification].[_ResourceGuid])
      LEFT OUTER JOIN [Inv_MOEVersion] AS [dca4_MOEVersion]
         ON ([vri2_Computer].[Guid] = [dca4_MOEVersion].[_ResourceGuid])
      INNER JOIN [Inv_AeX_AC_Client_Agent] AS [ajs5_Inv_AeX_AC_Client_Agent]
         ON ([vri2_Computer].[Guid] = [ajs5_Inv_AeX_AC_Client_Agent].[_ResourceGuid])
WHERE
   (
      ([vri2_Computer].[Guid] IN (SELECT [ResourceGuid] FROM [ScopeMembership] WHERE [ScopeCollectionGuid] IN (SELECT [ScopeCollectionGuid] FROM dbo.fnGetTrusteeScopeCollections(@v1_TrusteeScope))))
   )
GROUP BY
   [vri2_Computer].[Guid],
   [dca4_MOEVersion].[MOEVersion],
   [vri2_Computer].[Name],
   [vri2_Computer].[IsManaged],
   [dca3_AeX AC Identification].[Last Logon User]
ORDER BY
   [dca4_MOEVersion].[MOEVersion] DESC
 

Second report - found the sql on the forums

SELECT vc.Guid,vc.Name, arp.DisplayName,arp.DisplayVersion

FROM vComputer vc

JOIN Inv_AddRemoveProgram arp ON arp._ResourceGuid=vc.Guid

WHERE DisplayName LIKE 'microsoft office professional %' AND arp.InstallFlag=1

 


Viewing all articles
Browse latest Browse all 2021

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>