sql snippet to aggregated fires