Hi All,
I have recently created a SQL Script to list all Nodes with UnUsedPorts in the last 30 days.
I currently have an issue where by I would like to try and add either a COUNT or SUM that rather than displaying all the individual ports it just summarizes to show;
NodeName > Total Ports Unused > Total Used
Again keeping the filter on 30 days here, so if it was not used for 5 days it would not be shown.
Below is what I have thus far...
SELECT UDT.NodeID AS [NodeID]
,UDT.PortID AS [PortID]
,UDT.Caption AS [Caption]
,UDT.IP_Address AS [IP_Address]
,UDT.Name AS [Name]
,UDT.PortDescription AS [Port_Description]
,UDT.DaysUnused AS [DaysUnused]
,UDP.PortID AS [PortID2]
,UDP.AdministrativeStatus AS [AdminStatus]
,UDP.OperationalStatus AS [OperStatus]
FROM UDT_UnUsedPorts AS UDT
INNER JOIN UDT_Port AS UDP on UDP.PortID = UDT.PortID
WHERE (
ISNUMERIC(UDT.DaysUnused) = 1 AND CAST(UDT.DaysUnused AS INT) >= 30 OR UDT.DaysUnused = 'Never'
)
AND UDP.AdministrativeStatus = 1
AND UDP.OperationalStatus = 2
AND UDT.Caption Like 'Switch0-%' OR UDT.Caption Like 'Switch11-%'
Order By UDT.Caption
If you can help that would be very much appreciated.alexslv
Many Thanks in advance
Greg