Does anyone have any suggestions on making the following select statement more efficient? It is a very simple query but the SSRS using the code hits the timeout set.
SELECT
G.A
,B = IsNull(Avg(CAST(T.B as decimal)), 0)
,C = Sum(T.C)
,D = IsNull(Avg(CAST(T.D as decimal)), 0)
FROM
TableA as G
INNER JOIN
TableB as T ON T.An_ID = G.An_ID
group by G.A
This is a snippet of the code with identical grouping in the bigger script of the SP that the SSRS is using.
group by, andg.ais not in an aggregation function.