problem with date range
От | Kevin Heflin |
---|---|
Тема | problem with date range |
Дата | |
Msg-id | Pine.LNX.4.10.10001141702540.26735-100000@mercury.shreve.net обсуждение исходный текст |
Список | pgsql-general |
have a query like so: select crimeid, areaid, sum( CASE when dateof='1-8-2000' then total else 0 end) as crimes1 from stats GROUP BY crimeid, areaid; This works and gives me results like I want like so: crimeid|areaid|crimes1 -------+------+------- 4| 2| 0 5| 2| 0 5| 3| 20 6| 2| 0 7| 2| 0 8| 2| 0 9| 2| 0 10| 2| 0 11| 2| 0 12| 2| 0 But what I really need would be the same query as above but give me results which show total crimes for the Current year to date, and also total crimes for 'last week' Im wanting 'last week' to be the last complete week. Say today is 01/14/2000 the last complete week would be 01/02/2000 --> 01/08/2000 Any suggestions would be appreciated. Kevin -------------------------------------------------------------------- Kevin Heflin | ShreveNet, Inc. | Ph:318.222.2638 x103 VP/Production | 333 Texas St #175 | FAX:318.221.6612 kheflin@shreve.net | Shreveport, LA 71101 | http://www.shreve.net --------------------------------------------------------------------
В списке pgsql-general по дате отправления: