hi,
try this. If your table name is mytable:
select
a.homeid
, a.city
, coalesce(a.date, (select b.date from mytable b where
b.homeid=a.homeid and b.date is not null order by b.prepost=a.prepost
desc limit 1) ) as date
, a.measurement
, a.prepost
from
mytable a
Th
Hmm, no-one seemed to mention the obvious - a pl/pgsql function, either
triggered or run manually depending if you want to update on insert/update
or on demand.
On 7 August 2011 16:05, Sim Zacks wrote:
> **
> On 08/05/2011 07:32 PM, jeffrey wrote:
>
> I have a table that looks like this:
>
> ho
On 08/05/2011 07:32 PM, jeffrey wrote:
I have a table that looks like this:
homeidcity date measurement pre/post
123 san francisco 1/2/2003 1458 pre
123 san francisco NULL 1932 post
124 los angeles2/4/2005 938
Le vendredi 05 août 2011 à 09:32 -0700, jeffrey a écrit :
> I have a table that looks like this:
>
> homeidcity date measurement pre/post
> 123 san francisco 1/2/2003 1458 pre
> 123 san francisco NULL 1932 post
> 124 los angeles
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of jeffrey
Sent: Friday, August 05, 2011 12:33 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] Filling null values
I have a table that looks like this:
homeidcity
I have a table that looks like this:
homeidcity date measurement pre/post
123 san francisco 1/2/2003 1458 pre
123 san francisco NULL 1932 post
124 los angeles2/4/2005 938 pre
124 NULLNULL