pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Larry Rosenman <ler@lerctr.org>
To: Adam Wieckowski <adam-wieckowski@tlen.pl>
Cc: pgsql-sql@postgresql.org
Subject: Re: weird(to me) request
Date: Thu, 25 Sep 2003 14:02:04 -0500
Message-ID: <311350000.1064516524@lerlaptop-red.iadfw.net> (raw)
In-Reply-To: <3F733B0D.5050801@tlen.pl>
References: <294260000.1064515888@lerlaptop-red.iadfw.net>
	<3F733B0D.5050801@tlen.pl>



--On Thursday, September 25, 2003 20:59:25 +0200 Adam Wieckowski 
<adam-wieckowski@tlen.pl> wrote:

> U¿ytkownik Larry Rosenman napisa³:
>
>> 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 
entered, it points
to a valid acct_num.

LER



-- 
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

view thread (5+ messages)  latest in thread

Message-ID: <311350000.1064516524@lerlaptop-red.iadfw.net>
Permalink:  ../311350000.1064516524@lerlaptop-red.iadfw.net/
Also on:    postgresql.org/message-id/311350000.1064516524@lerlaptop-red.iadfw.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: ler@lerctr.org, adam-wieckowski@tlen.pl
  Subject: Re: weird(to me) request
  In-Reply-To: <311350000.1064516524@lerlaptop-red.iadfw.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox