From: | Jasen Betts <jasen(at)xnet(dot)co(dot)nz> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Merging 2 rows in a table |
Date: | 2011-01-03 18:52:17 |
Message-ID: | ift5t1$of7$1@reversiblemaps.ath.cx |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 2011-01-03, Alexander Farber <alexander(dot)farber(at)gmail(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2011-01-03 19:46:40 | Re: Shit happens |
Previous Message | Norberto Delle | 2011-01-03 16:40:14 | WAL Archiving Stopped |