Group by on Date

From: "maya(dot)more" <meena(dot)mk(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Group by on Date
Date: 2011-10-15 06:51:50
Message-ID: 1318661510830-4904685.post@n5.nabble.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

I have a table with Date and unit column. . I want to find sum of unit column
considering 3 days each

User will specify start and enddate

Eg

Date Unit
10/1/2011 1
10/2/2011 2
10/3/2011 3
10/4/2011 4
10/5/2011 4
10/6/2011 1
10/7/2011 2
10/8/2011 3
10/9/2011 1
10/10/2011 1
10/11/2011 1
suppose if user selects date 10/1/2011 to 10/6/2011

then output should be

start date enddate unit
10/1/2011 10/3/2011 6
10/4/2011 10/6/2011 9

pls let me know if anybody has any idea.

Thanks in advance

--
View this message in context: http://postgresql.1045698.n5.nabble.com/Group-by-on-Date-tp4904685p4904685.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Andreas Kretschmer 2011-10-16 08:11:57 Re: postgres sql help
Previous Message Good, Thomas 2011-10-14 18:28:15 Re: Tripping over (my own) stupidity - VARCHAR declaration minus specificity