how to INSERT foreign keys?

From: Phil Mitchell <phil(dot)mitchell(at)pobox(dot)com>
To: pgsql-novice(at)postgreSQL(dot)org
Subject: how to INSERT foreign keys?
Date: 2002-02-10 22:33:05
Message-ID: 4.3.2.7.2.20020210172848.00ac3bb0@pop.rcn.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

I have an <items> table, and a <keys> table, and a map table that relates
item_id's to key_id's. How do I populate item_keys with data?

I tried:

INSERT INTO item_keys SELECT item_id from items where item = 'item 1',
SELECT key_id from keys where key = 'key 1';

but the parser doesn't like that.

Thanks!

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message John Taylor 2002-02-11 10:23:10 Re: Using indexes and keys
Previous Message Eric Peters 2002-02-10 19:55:37 Re: How would I make this into a stored procedure? (Solved)