Re: [SQL] regular expression

2005-10-04 Thread Gnanavel S
Try this, select substring('6768 - THY','[0-9]*');  substring ---  6768 (1 row)On 10/4/05, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:How do I do regular _expression_ for the problem that I am havingI have a string called desc, and say that this string in "TSWUU"  -- """4 - DS

Re: [SQL] How to add column from old_table to new_table?

2005-09-21 Thread Gnanavel S
On 9/21/05, Joost Kraaijeveld <[EMAIL PROTECTED]> wrote: Hi,I made a mistake in describing the query I tried. The query I tried was:update new_tableset new_attribute = (select old_attribute from old_table, new_tablewhere old_table.id = new_table.id)where old_table.id = new_table.id It should be wr

Re: [SQL] How to add column from old_table to new_table?

2005-09-21 Thread Gnanavel S
On 9/21/05, Joost Kraaijeveld <[EMAIL PROTECTED]> wrote: Hi,I have an old_table with two columns: "id" and "old_attribute". I havenew table with the columns "id" and "new_attribute".old_table and new_table contain exactly the same id's. Now I want to copy all the old_attribute from old_table to the

Re: [SQL] Triggers & Conditional Assignment

2005-09-15 Thread Gnanavel S
coalesce(NEW.end_date , OLD.end_date) will solve the issue.On 9/15/05, Neil Saunders <[EMAIL PROTECTED] > wrote:Hi,I've run in to a small problem when writing a trigger. For simplicities sake lets say that I have 2 tables – 'bookings' and'unavailable_periods'. Both have columns 'start_date','end_da

Re: [SQL] Age in days

2005-09-12 Thread Gnanavel S
This will give you the no of days.select current_date - dateofbirth::date from people; On 9/9/05, Mark A. Strivens <[EMAIL PROTECTED]> wrote: If you need to know the age to the nearest day on the present dayI think you can use something like:select date_trunc('day',age(now(),dateofbirth)) from peop

Re: [SQL] diary constraints

2005-08-23 Thread Gnanavel S
On 8/23/05, Gary Stainburn <[EMAIL PROTECTED]> wrote: Hi folksI know this has been discussed in the past, but no amount of keywordshas returned anything from the archives.I want to create a courtesy car diary diary system where I have a tablecontaining all of the cortesy cars in the pool, and then

Re: [SQL] Joining two large tables on a tiny subset of rows

2005-07-26 Thread Gnanavel S
On 7/27/05, Dmitri Bichko <[EMAIL PROTECTED]> wrote: Hello,I have two tables, one has a foreing key from the other (only showingthe relevant columns and indices here): Table "expresso.probes"   Column|  Type  | Modifiers-++

Re: [SQL] Error when using array variable

2005-07-22 Thread Gnanavel S
On 7/22/05, Dongsoo Yoon <[EMAIL PROTECTED]> wrote: I use a function using array variable as following.   The function returns array type.   When array variable is allocated with any value,allocating is not done.   I can't find why it is.   --

Re: [SQL] Help With complex join

2005-07-14 Thread Gnanavel S
On 14 Jul 2005 14:34:02 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED] > wrote:Hi all, got a question as how to approach a somewhat complicated join query.  The deal is I have three tables called attorney, lawOffice, andlaw_office_employment.  The attorney and lawOffice tables hold attorneyand lawOffi