I am very new to SQL. The following is an SQL query for fetching 90/95/99th Percentile Traffic Rate for last one month. This is working fine, but it pulls out report for all the nodes in NPM. I want to add a filter to it, where it should pull the details for only the nodes that has the "Department" name "Greencloud".
DECLARE @EndDate DateTime
SET @StartDate = ${FromTime}
SET @EndDate = ${ToTime}
SELECT Interfaces.InterfaceId,
Nodes.NodeID,
Nodes.Caption AS NodeName,
Interfaces.Caption AS Interface_Caption,
Maxbps_In90,
Maxbps_Out90,
Maxbps_In95,
Maxbps_Out95,
Maxbps_In99,
Maxbps_Out99
FROM Nodes
INNER JOIN Interfaces ON Nodes.NodeID = Interfaces.NodeID
INNER JOIN (
SELECT InterfaceID,
dbo.GetInBpsPercentile(InterfaceID, @StartDate, @EndDate,90) AS Maxbps_In90,
dbo.GetOutBpsPercentile(InterfaceID, @StartDate, @EndDate,90) AS Maxbps_Out90,
dbo.GetInBpsPercentile(InterfaceID, @StartDate, @EndDate,95) AS Maxbps_In95,
dbo.GetOutBpsPercentile(InterfaceID, @StartDate, @EndDate,95) AS Maxbps_Out95,
dbo.GetInBpsPercentile(InterfaceID, @StartDate, @EndDate,99) AS Maxbps_In99,
dbo.GetOutBpsPercentile(InterfaceID, @StartDate, @EndDate,99) AS Maxbps_Out99
FROM InterfaceTraffic
WHERE InterfaceTraffic.DateTime >= @StartDate AND InterfaceTraffic.DateTime <= @EndDate
GROUP BY InterfaceID
) TrafficStat
ON Interfaces.InterfaceID = TrafficStat.InterfaceID