Host_status server names

Hello,

I am using a icingaDB to retrieve my data. Now I want to build a query, that allows me to see how often a server or host has sent an alert or warning message. Besides that I would like to get the server/host name instead of the IP-adress I am able to get.

Down below you can see a picture of my query and what happens.