X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.130]) by svr1.postgresql.org (Postfix) with ESMTP id 91C2FD1B502 for ; Thu, 25 Sep 2003 19:02:41 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (neptune.hub.org [64.117.224.130]) (amavisd-new, port 10024) with ESMTP id 48428-03 for ; Thu, 25 Sep 2003 16:02:11 -0300 (ADT) Received: from lerami.lerctr.org (lerami.lerctr.org [207.158.72.11]) by svr1.postgresql.org (Postfix) with ESMTP id 197D1D1B4EB for ; Thu, 25 Sep 2003 16:02:09 -0300 (ADT) Received: from lerlaptop-red.iadfw.net (lerlaptop-red.iadfw.net [207.136.3.72]) (authenticated bits=0) by lerami.lerctr.org (8.12.10/8.12.10/20030923) with ESMTP id h8PJ25Qa010070; Thu, 25 Sep 2003 14:02:06 -0500 (CDT) Date: Thu, 25 Sep 2003 14:02:04 -0500 From: Larry Rosenman To: Adam Wieckowski Cc: pgsql-sql@postgresql.org Subject: Re: weird(to me) request Message-ID: <311350000.1064516524@lerlaptop-red.iadfw.net> In-Reply-To: <3F733B0D.5050801@tlen.pl> References: <294260000.1064515888@lerlaptop-red.iadfw.net> <3F733B0D.5050801@tlen.pl> X-Mailer: Mulberry/3.1.0b7 (Linux/x86) X-PGP-Info: All other keys are old/dead. X-PGP-Key: 0x3c49bdd6 X-PGP-Fingerprint: D0D1 3C11 F42F 6B29 FA67 6BF3 AD13 4685 3C49 BDD6 MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="==========0BCECB76328615B817C6==========" X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200309/313 X-Sequence-Number: 15291 --==========0BCECB76328615B817C6========== Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline --On Thursday, September 25, 2003 20:59:25 +0200 Adam Wieckowski=20 wrote: > U=BFytkownik Larry Rosenman napisa=B3: > >> I have the following rows (in addition to others): >> >> acct_num text, >> master_acct_num text, >> >> >> These are in the same table. >> >> What I want to enforce is that if the master_acct_num field is NOT >> NULL (it can be NULL, and >> that's fine), that the value appears in some row as acct_num. >> acct_num has a unique index on it, so that's fine. >> >> I'm not sure how to do this.... >> >> Thanks! >> >> LER >> >> > select > case > when master_acct_num is null > then acct_num > else master_acct_num > end > from table; > > did you mained somethink like this ? I'm actually looking to enforce the fact that if master_acct_num is=20 entered, it points to a valid acct_num. LER --=20 Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749 --==========0BCECB76328615B817C6========== Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (FreeBSD) iD8DBQE/czusrRNGhTxJvdYRApvOAJ4r4kNF0dWpfuB/kJ2nxv8uv/vCKwCgorK4 N9JnOWPkrVMzM3rA0hCJUhI= =t7Dd -----END PGP SIGNATURE----- --==========0BCECB76328615B817C6==========--