Client Management Suite

 View Only
  • 1.  Need help with SQL

    Posted Oct 11, 2016 09:46 AM

    I have the following query that list all installs of the C++ 2010:

    SELECT arp1.DisplayName, arp1.DisplayVersion, arp1.InstallDate, c1.Name AS 'Computer', id1.[OS Name], id1.[OS Type]
    FROM vRM_Computer_Item c1
    JOIN Inv_AddRemoveProgram arp1 ON c1.Guid = arp1._ResourceGuid
    JOIN Inv_AeX_AC_Identification id1 ON c1.Guid = id1._ResourceGuid
    WHERE arp1.DisplayName LIKE '%Visual C++ 2010%'
    Order by DisplayVersion

    I need help to display only unique "DisplayVersion" just to see what i have out there.

    Thank you.



  • 2.  RE: Need help with SQL
    Best Answer

    Posted Oct 11, 2016 10:33 AM

    Is it Distinct Version Numbers on just the Program?

    SELECT DISTINCT
    	arp1.DisplayName
    	,arp1.DisplayVersion
    FROM 
    	Inv_AddRemoveProgram arp1
    WHERE 
    	arp1.DisplayName LIKE '%Visual C++ 2010%'

    If not you could try

    SELECT * 
    FROM (
    	SELECT 
    		arp1.DisplayName
    		,arp1.DisplayVersion
    		,arp1.InstallDate
    		,c1.NAME AS 'Computer'
    		,id1.[OS Name]
    		,id1.[OS Type]
    		,ROW_NUMBER() OVER (PARTITION BY arp1.DisplayVersion ORDER BY arp1.DisplayName) as RN
    	FROM 
    			vRM_Computer_Item c1 
    		JOIN Inv_AddRemoveProgram arp1 ON c1.Guid = arp1._ResourceGuid
    		JOIN Inv_AeX_AC_Identification id1 ON c1.Guid = id1._ResourceGuid
    		WHERE arp1.DisplayName LIKE '%Visual C++ 2010%'
    ) a
    WHERE a.RN = 1;

     



  • 3.  RE: Need help with SQL

    Posted Oct 11, 2016 12:14 PM

    Thank you