Igor,

I am using a temporary table where that condition will not occur but I
do appreciate the info as I was considering re-writing the SQL to see
if I could do it without using a temporary table and that would have
created the NULL condition you noted.

Thanks again for noting the potential problem with the SQL, it has
undoubtably saved me considerable time had I tried to re-write the SQL
without a temporary table.

And yes I did make a typo it should have been TableA.Field1.

Also thanks to all who helped me find a solution.


Greg


------------------------------

Message: 10
Date: Mon, 23 Feb 2009 20:35:41 -0500
From: "Igor Tandetnik" <itandet...@mvps.org>
Subject: Re: [sqlite] UPDATE Field based on matching value in
       different Table
To: sqlite-users@sqlite.org
Message-ID: <gnvite$3h...@ger.gmane.org>

"Greg Robertson" <trifus...@gmail.com>
wrote in message
news:151e70a00902231728j608612b8n491e84b11c70c...@mail.gmail.com
> That did it.
>
> Thanks
>
> Greg
>
> On Mon, Feb 23, 2009 at 7:05 PM, Griggs, Donald
> <donald.gri...@allscripts.com> wrote:
>> Hi Greg,
>>
>> Someone on the list may give a better reply, and I'm sending this to
>> you
>> directly, but I think the following will work:
>>
>> Update tableA
>>  set Field2 = ( select Field4 from tableB
>>    where TableA.Field3=TableB.Field4 );

If there are any rows in tableA without a matching row in tableB, this
would set Field2 in all such rows to NULL. This may or may not matter in
your case, of course.

Igor Tandetnik
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to