Where do I put group by clause in this sql?

Printable View