GROUP BY with Aggregate functions in SQL statement