I've got a SQL query that works in Database Manager, but the alert requires me to join that with a setup statement. I've done this to get a count of events per node, which works, but just a total count has me puzzled. Both the setup statement and the data I need counted are in the same table, so I'm not sure what to join together in the body of the alert.
I think I need something like this, but what do I put in the question marks?
SELECT Interfaces.FullName, Interfaces.InterfaceID, FROM Interfaces
Left JOIN (
select count(*) as stalecount FROM [dbo].[Interfaces]
where interfaceindex = '-1'
group by Interfaces.ObjectSubType
HAVING COUNT(*) >= 2
)
AS a ON a.??????=???????
Where stalecount >= 2
Btw, what's the purpose of the setup statement? Why not be able to just put the sql query in without it?