[SQL] defaults on updates

2003-11-01 Thread Martin Marques
Hi, I'm trying to make some sort of function, rule, trigger, or what ever that would be capable of modifing my table on an update. Basically, I have 5 fields, one being a PK (SERIAL), 3 with information, and the last one a timestamp field that will show the last time the register was modified (

Re: [SQL] defaults on updates

2003-11-01 Thread Tom Lane
Martin Marques <[EMAIL PROTECTED]> writes: > Basically, I have 5 fields, one being a PK (SERIAL), 3 with information, and > the last one a timestamp field that will show the last time the register was > modified (tmodif which has a DEFAULT CURRENT_TIMESTAMP). > Now, eveytime someone modifys any,

Re: [SQL] conditional query?

2003-11-01 Thread zen31329
As you say, it is easiest if there is only one level of 'parenting'..! SELECT p.id, CASE WHEN p.UseParentAddress = 'Y' THEN (SELECT address FROM profile WHERE id = p.parentid) ELSE address AS address FROM Profile p If you do have multiple levels, you'll need to recurse, either with a cursor or a

Re: [SQL] connectby

2003-11-01 Thread George Essig
> I use postgresql 7.2.3 > How can I use connectby ?? > > Must I install files ? or packages ? or it is recommanded to upgrade dataserver ? For recent versions of PostgreSQL, go into the contrib/tablefunc directory and see the readme file for how to install. I downloaded PostgreSQL 7.2.3 and the