From: Frank Morton <fmorton@base2inc.com>
To: pgsql-sql@postgresql.org
Subject: conditional query?
Date: Fri, 31 Oct 2003 08:30:16 -0500
Message-ID: <5D07F76A-0BA6-11D8-A615-000A95A83378@base2inc.com> (raw)
I have a table called a "profile" that has company addresses as well
as individual contact information. Simpifying:
id (the primary key)
parentId (any profile can have a parent ie, contact parent is a company)
address (for this example, will just have one piece of the address)
useParentAddress
If "useParentAddress"=="Y", that means that the parent address of this
person should really be used for mailings. If == "N" then the address
with that profile is the right one to use.
Is there any way to do a single select to get a single "address" back
that is the right one depending on the value of "useParentAddress"
field?
Also want to make this sql as portable as possible.
Will appreciate any ideas.
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: fmorton@base2inc.com
Subject: Re: conditional query?
In-Reply-To: <5D07F76A-0BA6-11D8-A615-000A95A83378@base2inc.com>
* 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