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,
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
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?
> >
> >
> >
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
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
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
6 matches
Mail list logo