X-Original-To: pgsql-sql@postgresql.org Received: from spampd.localdomain (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 4AA4C475F3D for ; Mon, 7 Apr 2003 14:27:15 -0400 (EDT) Received: from davinci.ethosmedia.com (unknown [209.10.40.251]) by postgresql.org (Postfix) with ESMTP id 5E217475F34 for ; Mon, 7 Apr 2003 14:27:14 -0400 (EDT) Received: from [216.135.165.74] (HELO temoku) by davinci.ethosmedia.com (CommuniGate Pro SMTP 4.0.2) with ESMTP id 2949236; Mon, 07 Apr 2003 11:27:07 -0700 Content-Type: text/plain; charset="iso-8859-1" From: Josh Berkus Reply-To: josh@agliodbs.com Organization: Aglio Database Solutions To: saads@umich.edu (Saad Saeed), pgsql-sql@postgresql.org Subject: Re: Creating a foreign key on the Union of two tables Date: Mon, 7 Apr 2003 11:27:03 -0700 User-Agent: KMail/1.4.3 References: In-Reply-To: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200304071127.03166.josh@agliodbs.com> X-Spam-Status: No, hits=-31.6 required=5.0 tests=BAYES_10,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES, REPLY_WITH_QUOTES,USER_AGENT_KMAIL autolearn=ham version=2.50 X-Spam-Level: X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) X-Archive-Number: 200304/102 X-Sequence-Number: 12803 Saad, > I have 2 tables "A" and "B" in mySQL. They both have an attribute 'id' > which is unique between the 2 tables. I want the union of these 2 > attributes to be a foreign key in a 3rd table "C". How do I specify > this constraing in sql (mySQL) in table C? And for complex reasons I > cannot merge the 2 tables A and B. IMHO, you cannot do this in MySQL. How about upgrading to PostgreSQL? The= n=20 we can help you. --=20 -Josh Berkus Aglio Database Solutions San Francisco