Re: [SQL] Subqueryes

2007-03-22 Thread Ezequias R. da Rocha
Perfect quite nice. I am doing things that I could not believe I could do without the community. Thank you so much. -- Atenciosamente Ezequias Rodrigues da Rocha Richard Broersma Jr escreveu: update myTable set date = (current_date + (Select daysToAdd from base.Table1 where myFKey_id = Tab

Re: [SQL] Subqueryes

2007-03-22 Thread Richard Broersma Jr
> > update myTable > set date = (current_date + (Select daysToAdd from base.Table1 where > myFKey_id = Table1Id) ) > where Expire_Date = now()::Date; Does this work: http://www.postgresql.org/docs/8.2/interactive/sql-update.html UPDATE myTable SET date = current_date + B.daysToAdd FROM Table1 B

Re: [SQL] Subqueryes

2007-03-22 Thread Alvaro Herrera
Ezequias R. da Rocha wrote: > Hi list, > > I must add some days (i.e:365) to my current_date and put it in my table > (an UPDATE). By now, it is simple but my "days to add" is in another table. > > How could I do this kind of update > > My sql is like this (but is not working): > > update myTa

[SQL] Subqueryes

2007-03-22 Thread Ezequias R. da Rocha
Hi list, I must add some days (i.e:365) to my current_date and put it in my table (an UPDATE). By now, it is simple but my "days to add" is in another table. How could I do this kind of update My sql is like this (but is not working): update myTable set date = (current_date + (Select daysToA