Tuesday, December 30, 2014

GROUP BY TINYINT

I have this simple query:



SELECT t1.col1, t2.col2
FROM dbo.tbl1 t1 INNER JOIN tbl2 t2
ON...
GROUP BY t1.col1, t2.col2

but I get error: "Cannot call methods on tinyint"

TinyInt column is t2.col2.



From when you cannot use group by on tiny int column?



What is interesting is that DISTINCT works without error:



SELECT DISTINCT t1.col1, t2.col2
FROM dbo.tbl1 t1 INNER JOIN tbl2 t2
ON...

Can someone explain? In the past DISTINCT and GROUP BY worked the same(same execution plan). I have SQL 2014 developer version.


No comments:

Post a Comment