Update with data from table creates random input

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

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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Randall Perry 2002-04-17 16:16:35 Re: Update with data from table creates random input
Previous Message Mark Price 2002-04-17 16:08:31 Re: j2sdk1.4.0 jdbc compile errors