Make query compatible with MS Sql.
Fix bad use statement.