On Dec 23, 2007, at 10:58 AM, John K. wrote:
I am embarrassed to say I am having problems with the group by syntax.
What I want to do is take a record set that is returned and group
it by the updated_at field (but only up to the day and not hours,
seconds, minutes, etc.). So that I can display a list broken up by
Can someone help me with the syntax?
I have a table that records when a task is completed. If I want to
see how many tasks were completed on each day, I could do something like
select substring(completed, 1, 10) as completed, count(*)
group by substring(completed, 1, 10)
order by completed
That’s PostgreSQL, and there is probably a more correct way of doing
it, but that works. Just remember that any column in the select that
is not an aggregate must be included in the group by. That’s where
it starts to get cumbersome.