group by date problem giving multiple entries [Resolved]

Posted by RohiK under Sql Server on 11/9/2011 | Points: 10 | Views : 1167 | Status : [Member] | Replies : 5
Hi,

I have many entries everyday, I want to calculate how many entries per day

I used

select count(*), date from entries group by date

how to calculate?

Happy Programming!!
Rohi



Responses

Posted by: Niladri.biswas on: 11/14/2011 [Member] Platinum | Points: 50

Up
0
Down

Resolved
I believe it is happening as because the time componenet is also coming into picture. Use only the date componenet and that will serve the purpose

Best Regards,
Niladri Biswas

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Blessyjees on: 11/9/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

What result you are getting when run this query.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 11/9/2011 [Member] Starter | Points: 25

Up
0
Down
the result is simple count is 1 and date gets repeated

Happy Programming!!
Rohi

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: PandianS on: 11/9/2011 [Member] [MVP] Silver | Points: 25

Up
0
Down
Rohi

Can you pls try this ?
Select	Convert(Varchar(10),[Date],21) [Date],

Count(1) [Entries] from entries
Group By Convert(Varchar(10),[Date],21)
Order By 1



Cheers
www.SQLServerbuddy.blogspot.com
iLink Multitech Solutions

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: RohiK on: 11/15/2011 [Member] Starter | Points: 25

Up
0
Down
Thanks

Happy Programming!!
Rohi

RohiK, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response