开发者

cumulative sum per day in rails&postgresql

开发者 https://www.devze.com 2023-01-19 21:07 出处:网络
Ive got a table \'don开发者_如何学JAVAations\' which is filled (by users) on a daily basis. I would like to create a graph that shows the cumulative number of donations per day.

Ive got a table 'don开发者_如何学JAVAations' which is filled (by users) on a daily basis. I would like to create a graph that shows the cumulative number of donations per day.

So,

table donations:
id  created_at
1   19/01 
2   20/01
3   20/01
4   21/01

Should become:

[1,3,4]

How to do this with rails3&postgresql? Thanks in advance


So its actually quite easy..

simply select "DISTINCT"... ok, this was a n00b question, figured it out! for the people that want to know more > How do I (or can I) SELECT DISTINCT on multiple columns?

0

精彩评论

暂无评论...
验证码 换一张
取 消