| SQL - Questions and Answers Have a SQL question? Post it here. First do a search to see if someone hasn't already answered it. |
|
|||
How can I sum values by weekI have a table say CLFILE which has many entries each one has a date and an amount which can be either positive or negative.
To sum the balance up to a certain date I would write - SELECT SUM(CLCASH) AS WEEK30 FROM CLFILE WHERE CLDATE < '20070628' This would give say - WEEK30 -------- 203.45 Do any of you SQL wizards know of a way to display what the balance was each week without having to do 52 queries? Any help would be appreciated. Dave |
![]() |
| Thread Tools | Search this Thread |
|
|