Re: Access SQL Text Comparisons

From: Date: Tue, 10 Oct 2000 17:21:49 +0000
Subject: Re: Access SQL Text Comparisons
References: 1  Groups: php.windows 
Request: Send a blank email to php-windows+get-3113@lists.php.net to get a copy of this message
Derek: Access, by default, does not allow zero length strings, so your blank fields are actually NULL values. When you perform a comparison with NULL values the result is also a NULL and this is interpreted as FALSE by the WHERE clause. I would recommend something like this: UPDATE table1, table2 SET table1.AMEND_VERSION_T = "1.2.1" WHERE (table1.Code = table2.Code) OR (isnull(table1.Code) AND isnull(table2.Code)); No need for the brackets in the WHERE clause, unless the table or field names use special characters. Saludos, Pablo Vera _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ Tuesday, October 10, 2000, 12:07:46 PM, Derek wrote: DP> For some reason I'm having trouble with an Access2000 SQL Update query DP> (can't do it in PHP for techy reasons). DP> The comparison is between text fields and all is well if both have values DP> and are equal. It doesn't match however if both fields are blank. DP> Record Field1 Field2 DP> 1 A A Query correctly updates as equal DP> 2 A B Query correctly ignores as different DP> 3 Query incorrectly ignores even though DP> equally blank DP> UPDATE table, table2 SET table1.AMEND_VERSION_T = "1.2.1" DP> WHERE ([table1].[Code])=([table2].[Code]); DP> Using Like is still running after 20 minutes! DP> TIA DP> Derek

« previous php.windows (#3113) next »