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 "
Why dont you try a combination of
CASE WHEN ... THEN ... ELSE ... END construct
along with a LEFT OUTER join (in case parentId is null).
Not sure how "portable" the above will be.
O kyrios Frank Morton egrapse stis Oct 31, 2003 :
> I have a table called a "profile" that has company addresses as
Try something like
SELECT p2.*
FROM profile p1, profile p2
WHERE ( p1.id =1 AND useParenAddres = 'N' AND p2.id = p1.id )
OR ( p1.id =1 AND useParenAddres = 'Y' AND p2.id = p1.parentId)
Obviously this won't work if you have more than one level of parent
hood, i.e. it would pick up a grand
What I am trying to do is select all the rows out of the categories
table (see below) and select the sum of j_amount out of the judgment
table. Right now it is only returning the categories that are in the
judgment table. I want it to return those fields with the amounts out
of the judgment tabl
Dnia 2003-10-31 20:19, Użytkownik Shaun Watts napisał:
What I am trying to do is select all the rows out of the categories
table (see below) and select the sum of j_amount out of the judgment
table. Right now it is only returning the categories that are in the
judgment table. I want it to return
On Thu, 2003-10-30 at 20:13, Jan Wieck wrote:
> Thanks for reporting, Michele.
Thank to you! The speed and level of your responses exceeds every my
more rose-colored expectation ;-)
> In the meantime, you might want to use a
> BEFORE INSERT trigger in PL/pgSQL that tries to UPDATE the row and i