Quantcast
Channel: SQL Server Reporting Services, Power View forum
Viewing all articles
Browse latest Browse all 10045

Suppress Duplicates

$
0
0

I am running a query in report builder with a union between two select statements to list machines and their AV product, but some machines do not have anything installed. The first statement brings back the results of the ones with a detected product and then the second statement just brings back all the machines in the group and so some machines show up in each statement - I have a field in the second statement which just returns an empty field (vAgentStatusRpt.toolTipNotes). I want to display the machines if they match the first statement, but if it is then listed in the second statement as well I don't want to display the second result. Is that possible?

SELECT
  VMonitorEventsetAgentAssignment.machName
  ,VMonitorEventsetAgentAssignment.EventSetName
  ,vAgentStatusRpt.OperatingSystem
FROM
  kasadmin.org
  INNER JOIN machGroup
    ON kasadmin.org.id = machGroup.orgFK
  INNER JOIN dbo.machNameTab mn
    ON machGroup.machGroupGuid = mn.machGroupGuid
  INNER JOIN VMonitorEventsetAgentAssignment
    ON mn.agentGuid=VMonitorEventsetAgentAssignment.agentGuid
  INNER JOIN vAgentStatusRpt
    ON mn.agentGuid = vAgentStatusRpt.agentGuid
WHERE
  VMonitorEventsetAgentAssignment.EventSetName LIKE N'%AV - %'
  AND kasadmin.org.orgName = @account_name

UNION

SELECT
  vAgentStatusRpt.ComputerName
  ,vAgentStatusRpt.toolTipNotes
  ,vAgentStatusRpt.OperatingSystem
FROM
  kasadmin.org
  INNER JOIN machGroup
    ON kasadmin.org.id = machGroup.orgFK
  INNER JOIN dbo.machNameTab mn
    ON machGroup.machGroupGuid = mn.machGroupGuid
  INNER JOIN vAgentStatusRpt
    ON mn.agentGuid = vAgentStatusRpt.agentGuid
WHERE
  kasadmin.org.orgName = @account_name


Viewing all articles
Browse latest Browse all 10045

Trending Articles



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