SQL1816 error means?
Failed to aggregate
Failed to execute DISTINCT
Failed to execute HAVING clause
Failed to execute WHERE clause