Report of the Icinga history

Hello all,
We want to make an evaluation via SQL.
We try to query the following:

How often is a check reported per host critical.
Can someone provide me with a SQL for this?

Do you use icingadb or ido?