Found this now:
UPDATE Table1 SET Field1 =
(case when Field1 IN (SELECT Field1 FROM Table2)
then
(SELECT Field2 FROM Table2 WHERE Table1.Field1 = Table2.Field1)
else
Table1.Field1 end)
Have a feeling though that this can be shorter.
RBS
-----Original Message-----
From: RB Smissaert [mailto:[EMAIL PROTECTED]
Sent: 31 January 2008 20:15
To: [email protected]
Subject: [sqlite] how to do this case when?
How do I alter this SQL, so that the original field remains the same when
there is no match? A case when else end should do it, but I can't get it
right.
UPDATE Table1 SET Field1 =
(SELECT Field2 FROM Table2
WHERE Table1.Field1 = Table2.Field1)
Thanks for any advice.
RBS
----------------------------------------------------------------------------
-
To unsubscribe, send email to [EMAIL PROTECTED]
----------------------------------------------------------------------------
-
-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------