Updated MSSQL query