i open one transaction and insert a row into table and close the ssms and reopen and check table but uncommitted transaction were in the resultset why this happen please tell me
Because there is data for some other month that has a 28th. I would recommend:
select cast([datetime] as date), count(*) from (select distinct cm.* from logs_currentmonth cm ) cm where [datetime] >= '2016-10-01' group by cast([datetime] as date) order by cast([datetime] as date);
If you don't need the
select distinct, then don't use it! It just slows down the query.