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

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 ?

Attachments:

  smime.p7s (application/x-pkcs7-signature, 4.0K) download

view thread (5+ messages)  latest in thread

Message-ID: <3F733B0D.5050801@tlen.pl>
Permalink:  ../3F733B0D.5050801@tlen.pl/
Also on:    postgresql.org/message-id/3F733B0D.5050801@tlen.pl

 · 

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: adam-wieckowski@tlen.pl, ler@lerctr.org
  Subject: Re: weird(to me) request
  In-Reply-To: <3F733B0D.5050801@tlen.pl>

* 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