Results 1 to 2 of 2
.cn$5.76 per year!!! Forum: Domain Name SalesReplies: 0
04-12-2005, 02:26 AM #1
How to get year, month and day from PostgreSQL datestamp?
I have to count database entries for specific months and I cannot figure out how to group the results by months:
select datestamp, count(hits) from users group by datestamp
This will group hits by the whole timestamp including minutes and seconds, but how can I group the results by the months?
04-12-2005, 03:57 AM #2
Re: How to get year, month and day from PostgreSQL datestamp?
I'm more of a mySQL man myself, but if I remember correctly to_char is a good way to get specific date formatting:
select to_char(datestamp, 'month') from users group by to_char(datestamp, 'month')
The only thing I'm not sure about is whether you can just dump the function in there in that manner. Try it and see, le us know.If one of our members helps you, please click the icon to add to their reputation!
No support via email or private message - use the forums!
Before you ask, have you Searched?