Re: Creating composite keys from csv - Mailing list pgsql-general

From John McKown
Subject Re: Creating composite keys from csv
Date
Msg-id CAAJSdjgnrpcYb_hkt7pM7AWBTiOsf2g4RRmoMemaAFS-=TLkrw@mail.gmail.com
Whole thread Raw
In response to Re: Creating composite keys from csv  (Eli Murray <ejmurra2@illinimedia.com>)
List pgsql-general
On Mon, Mar 9, 2015 at 10:12 AM, Eli Murray <ejmurra2@illinimedia.com> wrote:
> Thank you all for your help. I'm following along with John McKown's
> suggestion but when I run the update query I get "UPDATE 32956" but the
> personid column in my rawdata table has null values for every record.
>
> Here's the exact query I ran:
>
> UPDATE rawdata SET personid = (SELECT personid FROM assignid WHERE
> rawdata.personid = assignid.personid);

My apologies. I really messed that one up. And your analysis is
correct. I will plead "early morning brain failure". The UPDATE should
look like:

UPDATE CollegeData SET PersonID=SELECT PersonID from AssignID where
CollegeData.Name = AssignID.Name & CollegeData.TotalSalary =
AssignID.TotalSalary;

>
> I think the issue might be that it's only selecting records where personid
> is the same in both tables and right now there are only null values in
> rawdata.personid. What query should I write to SET rawdata.personid =
> assignid.personid WHERE rawdata.employeename && rawdata.totalsalary =
> assignid.name && assignid.totalsalary?
>

--
He's about as useful as a wax frying pan.

10 to the 12th power microphones = 1 Megaphone

Maranatha! <><
John McKown


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: pg_upgrade failing from 9.3 to 9.4 because "template0" already exists
Next
From: Anushka Chandrababu
Date:
Subject: Re: pg_conndefaults Returning empty string