I could use some assistance on this. I'm pretty rusty on doing anything SQL, and have never really done joins, and I don't have much experience manually digging around the SolarWinds database. I'm looking to create a report that shows the last 30 (or maybe 90?) days of alerts with for a specific client. We have a custom property for the client name. I was able to get a query to pull most of what I need from the Alert History View, but I want the report to show the time the alert triggered, when it was acknowledged, and ideally when it reset. That's where I'm getting stuck. That info isn't in the AlertHistoryView so I'm assuming I need to another table. The AlertActive table seems to have the data I need and the AlertActiveID appears to link the two but I'm apparently missing something.
SELECT ah.EventTypeWord, ah.Message, ah.TimeStamp, ah.RelatedNodeCaption FROM AlertHistoryView ah
INNER JOIN NodesCustomProperties ncp
ON ah.RelatedNodeID =ncp.NodeID
WHERE ncp.CustomerName = 'Client Name' AND ah.EventTypeWord = 'Triggered' AND ah.TimeStamp >= DATEADD(month,-1,GETDATE())
ORDER BY ah.TimeStamp
But when I add a second join, I get no results.
INNER JOIN AlertActive aa
ON ah.AlertActiveID=aa.AlertActiveID
If I manually search for a specific AlertActiveID number in both tables, I get the data I would expect, so what am I not understanding about doing multiple joins? Or am I completely approaching this the wrong way entirely?