The query does not conform to SQL syntax, because it uses the WITH TIES clause without an attendant ORDER BY clause. Either remove the WITH TIES clause or add an ORDER BY clause.
Submit feedback about this site to: