I am updating a query for a report. The original query has an index hint for the JOIN and also a HASH UNION hint for the query (the query consists of two parts with UNION operator). Now, on the client we do one extra simple query to add a total amount for
My first thought was to remove this extra processing on the client (though I suspect it's rather quick) and add totals using cte of the original query and partition by group clause.
Now, 1) Do you think this idea is good at all to add this extra column directly from SQL Server
2) How (and there) should I add this query hint? It doesn't allow me to do so in CTE as I'm getting a syntax error expression.
In the meantime I'm also experimenting with this query on a huge database with adding/removing hints.
Thanks in advance.
For every expert, there is an equal and opposite expert. - Becker's Law
View Complete Post