conditional query?

From: Frank Morton <fmorton(at)base2inc(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: conditional query?
Date: 2003-10-31 13:30:16
Message-ID: 5D07F76A-0BA6-11D8-A615-000A95A83378@base2inc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Achilleus Mantzios 2003-10-31 13:47:49 Re: conditional query?
Previous Message Michele Bendazzoli 2003-10-31 08:49:42 Re: 7.4 and 7.3.5 showstopper (was: Re: Bug in Rule+Foreing