When trying to LEFT JOIN two temp tables I have, I'm getting the arithmetic overflow error. When doing a UNION, there's no issue, nor is there an issue when I change my SELECT statement to not use SUM functions. Here are my two tables:
SELECT SUM(count) count
, EventType
, month
FROM #engine_final
GROUP BY EventType
, month
UNION ALL
SELECT SUM(count) count
, EventType
, month
FROM #circumvent_final
GROUP BY EventType
, month
And here's the results:
So what I'm attempting to do is SUM my counts, grouped by month, with the following query:
SELECT SUM(ef.count) AS EngineStarts
, SUM(cf.count) AS Circumventions
FROM #engine_final ef
LEFT JOIN #circumvent_final cf ON ef.month = cf.month
But this is when I'm confronted with the error. I thought maybe I had hit the limit for INT, but my numbers only reach about 260 million, so that can't be it. What am I missing?
