Tuesday, December 30, 2014

GROUP BY TINYINT

Not able to simulate your issue. The below code works for me in SQL Server 2014.


Could you please share your complete code or simple simulated code?



create Table T1(Col1 tinyint, col2 tinyint)
create Table T2(Col1 tinyint, col2 tinyint)

SELECT t1.col1, t2.col2
FROM dbo. t1 INNER JOIN t2
ON t1.col1 = t2.col1 and t1.col2 = t2.col2
GROUP BY t1.col1, t2.col2

SELECT DISTINCT t1.col1, t2.col2
FROM dbo. t1 INNER JOIN t2
ON t1.col1 = t2.col1 and t1.col2 = t2.col2
--GROUP BY t1.col1, t2.col2

Drop table T1,T2


No comments:

Post a Comment