Fixed 'HAVING' - didn't get properly queried with pagination