On 2011-01-03, Alexander Farber <alexander.far...@gmail.com> wrote:
> Hello,
>
> through some obscure error (probably on my side)

>  Column |         Type          |                Modifiers
> --------+-----------------------+-----------------------------------------
>  id     | character varying(32) |
>  money  | integer               | not null
>  yw     | character(7)          | default to_char(now(), 'YYYY-IW'::text)

'YYYY-IW' above should be 'IYYY-IW'

(you may have made a similar mistake in other places too.)

> I have several thousand entries for Jan 1 and Jan 2
> ending up in the ISO week 2011-52 instead of 2010-52
> which breaks the bar chart at the top of my script
> http://preferans.de/user.php?id=OK504891003571

> I would like to fix that problem by adding
> 2011-52 values of money (10 above) to the
> 2010-52 values of money (63 above, should become 73)
> and then dropping all rows with the
> wrong week number yw='2011-52'.

perhaps something like this:

 update pref_money as dat set money=dast.money+ foo.money from
  pref_money as foo where dat.id=foo.id 
  and dat.yw='2011-52' 
  and foo.yw ='2012-52' ;
  
-- 
⚂⚃ 100% natural

-- 
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Reply via email to