Simple SQL question, need help.

From: fyzfeech(at)yahoo(dot)com (feech)
To: pgsql-general(at)postgresql(dot)org
Subject: Simple SQL question, need help.
Date: 2001-05-25 16:59:42
Message-ID: 30532257.0105250859.51f97dd1@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I'm pretty much an idiot, but I can't figure out how to do this:

I have a results DB with two fields: PlayerID and Position. I also
have a players DB with two fields: ID and Name.

How do I insert a record into results with PlayerID selected from the
players DB and Position explicitly specified by me.

Something like:

INSERT INTO results (PlayerID, Position) values (SELECT players.id
from players WHERE name = 'Chuck', 4 );

That statement is trying to insert the player's ID (I only have his
name when inserting) and his position ( 4 in this case ), but it
doesn't work.

Totally frustrated,
feech

Responses

Browse pgsql-general by date

  From Date Subject
Next Message The Hermit Hacker 2001-05-25 17:09:48 PostgreSQL v7.1.2 Now Available ...
Previous Message Tim Barnard 2001-05-25 16:55:14 Re: Cursor question