Re: Creating composite keys from csv

From: John McKown <john(dot)archie(dot)mckown(at)gmail(dot)com>
To: Eli Murray <ejmurra2(at)illinimedia(dot)com>
Cc: PostgreSQL General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Creating composite keys from csv
Date: 2015-03-09 16:49:50
Message-ID: CAAJSdjgnrpcYb_hkt7pM7AWBTiOsf2g4RRmoMemaAFS-=TLkrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Mon, Mar 9, 2015 at 10:12 AM, Eli Murray <ejmurra2(at)illinimedia(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Anushka Chandrababu 2015-03-09 16:52:43 Re: pg_conndefaults Returning empty string
Previous Message Bruce Momjian 2015-03-09 16:43:05 Re: pg_upgrade failing from 9.3 to 9.4 because "template0" already exists