I'm just hoping that someone might be able to help me out with a tricky SELECT statement that I can't get my head around.
I have two tables - one that contains SERVER items, and another that contains performance ALERTS for those servers.
Here are some relevant fields:
SERVERS (table)
serverid
accountid
servername
ALERTS (table)
alertid
serverid
alerttext
I need to write a SELECT statement that gives me all of the servers for a particular account. e.g.
SELECT serverid, servername FROM servers WHERE accountid=123
and also a COUNT of the number of alerts that each server currently has.
So, the end result might look something like this:
serverid servername numalerts
0 svr01 0
1 svr02 3
2 svr03 1
3 svr04 0
Can anyone help out with that?