I have a SWQL script below that looks at containers and VMs and then groups them.The script is below
SELECT n.DisplayName AS [Node Name]
,CASE
WHEN m.containerID = '218' Then 'DBA'
WHEN m.containerID = '217' Then 'BICC'
WHEN m.containerID = '219' Then 'Finance'
WHEN m.containerID = '220' Then 'Finance Payroll'
WHEN m.containerID = '222' Then 'Networks Team'
WHEN m.containerID = '221' Then 'Infrastructure'
WHEN m.containerID = '223' Then 'Office Prod'
WHEN m.containerID = '224' Then 'Security'
WHEN m.containerID = '225' Then 'Service Desk'
END as [VM Service Owner]
,Case
WHEN m.containerID = '228' Then 'UKBVB'
WHEN m.containerID = '229' Then 'USARI'
WHEN m.containerID = '230' Then 'UAEBS'
End as [Org Owner]
FROM Orion.VIM.VirtualMachines AS n
LEFT JOIN Orion.ContainerMembers AS m ON m.name=n.DisplayName AND MemberEntityType='Orion.VIM.VirtualMachines'
The output is showing the details of what each VM is in what group by th heading however the VMs are duplicating.
So an example of what i want it to be is
vm | Service Owner | Org Owner |
uk-lon-456 | Service Desk | ukbvb |
us-dal-123 | | usari |
us-tex-345 | BICC | |
However the output is showing something like this
VM | Service Owner | Org Owner |
uk-lon-456 | Service Desk | |
uk-lon-456 | | ukbvb |
us-dal-123 | | usari |
How do i merge VM names so they do not double/triple up the names?