Can't use a sql with group by clause