Re: Update with data from table creates random input

From: Randall Perry <rgp(at)systame(dot)com>
To: <rgp(at)systame(dot)com>
Cc: <pgsql-general(at)postgresql(dot)org>
Subject: Re: Update with data from table creates random input
Date: 2002-04-17 16:16:35
Message-ID: B8E31823.1338E%rgp@systame.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

WHOOPS!

Never mind. I discovered there were some extra rows with bad data in the
cust_temp table.

> I've got the following query which imports address data from one table into
> another based on the value of the primary key, cust_no.
>
> This query is successful, but the imported rows DO NOT MATCH the primary key
> of the updated table.
>
> I've checked the 2nd table to make sure the key values and addresses match,
> and they do.
>
> So, if cust_no 1 is supposed to be Miami, FL, it's becoming Flint, MI. The
> rows are correct, the address, city, state, zip is right for each record,
> it's just getting imported to the wrong cust_no.
>
> What gives?
>
>
>
> update cust2
> set address = cust_temp.address,
> address2 = cust_temp.address2,
> city = cust_temp.city,
> state = cust_temp.state,
> zip = cust_temp.zip
> from cust_temp
> where cust2.cust_no = cust_temp.cust_no;
>

--
Randy Perry
sysTame
Mac Consulting/Sales

phn 772.589.6449
mobile email help(at)systame(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephan Szabo 2002-04-17 16:30:39 Re: use of temporary tables in functions
Previous Message Randall Perry 2002-04-17 16:08:40 Update with data from table creates random input