Removed GROUP BY clause as it breaks the query in MS SQL Server