关于SQL中distinct 和 group by混用问题

比如有这么一张表TAB

col1 col2 col3
1 1 2
2 1 2
3 1 3
4 2 2

现在想按col2分组,然后统计分组中col3(distinct)个数。
之前只用一下语句:

select col2,count(distinct col3) from table TAB group by col2;

发现结果不不符合预期(由于题主这边没有测试数据库,不知道数据有没有造对)。请问有大神指点吗?

select count (*) as cnt, col2 from table group by col2, col3