Re: [sqlite] Update A table

2006-04-05 Thread Jim Dodgen
the way I do it is: update table1 set table1.f1 = (select table2.f1 from table2 WHERE table1.f0 = table2.f0) where exists (select * from table2 WHERE table1.f0 = table2.f0); Francisco Tapia wrote: I want to update data from table1 to table2, i seems I cannot get this to work right,

Re: [sqlite] Update A table

2006-04-05 Thread Francisco Tapia
very cool. thanks. On 4/5/06, Dennis Cote <[EMAIL PROTECTED]> wrote: > Francisco, > > You might want to add a coalesce() call so the f1 value is only changed > if there is a corresponding value in table2. > > update table1 > set f1 = coalesce((select f1 from table2 where table2.f0 = table1.f0), f

Re: [sqlite] Update A table

2006-04-05 Thread Francisco Tapia
Dennis, That seems to be the correct syntax... very cool.. many thanks!!! --Francisco On 4/5/06, Dennis Cote <[EMAIL PROTECTED]> wrote: > Francisco Tapia wrote: > > >I want to update data from table1 to table2, i seems I cannot get this > >to work right, perhaps my syntax is wrong? > > > > > >

Re: [sqlite] Update A table

2006-04-05 Thread Dennis Cote
Francisco, You might want to add a coalesce() call so the f1 value is only changed if there is a corresponding value in table2. update table1 set f1 = coalesce((select f1 from table2 where table2.f0 = table1.f0), f1) Dennis Cote

Re: [sqlite] Update A table

2006-04-05 Thread Dennis Cote
Francisco Tapia wrote: I want to update data from table1 to table2, i seems I cannot get this to work right, perhaps my syntax is wrong? update table1 set table1.f1 = table2.f1 FROM table1, table2 WHERE table1.f0 = table2.f0 -- -Francisco http://pcthis.blogspot.com |PC news with out the jarg

[sqlite] Update A table

2006-04-05 Thread Francisco Tapia
I want to update data from table1 to table2, i seems I cannot get this to work right, perhaps my syntax is wrong? update table1 set table1.f1 = table2.f1 FROM table1, table2 WHERE table1.f0 = table2.f0 -- -Francisco http://pcthis.blogspot.com |PC news with out the jargon! http://sqlthis.blogspo