Re: update with a join

From: <dellera_at_my-deja.com>
Date: Sun, 29 Oct 2000 10:51:28 GMT
Message-ID: <8tgvfg$9jq$1_at_nnrp1.deja.com>


Sybrand,

are the statements quoted below perfectly equivalent, I mean regarding NULL values the could be present in col1, col2 ?

In other words: is

(1) where (a,b) = (a2,b2)

exactly the same as

(2) where a = a2 and b = b2
?

In (2), if a (or b,a2,b2) is null, the
where condition is false. Does the same
apply to (1) ?

Thanks in advance
Alberto

> The correct syntax for a subquery on multiple columns is
> UPDATE tbl1 t1
> SET t1.col0 = 0
> WHERE
> (t1.col1, t1.col2)
> in
> (SELECT t2.col1, t2.col2 from tbl2 t2)
>
> Performance wise you would better
> update tbl1 t1
> set t1.col0 = 0
> where exists
> (select 'x'
> from tbl2 t2
> where t2.col1 = t1.col1
> and t2.col2 = t1.col2)
>

Sent via Deja.com http://www.deja.com/
Before you buy. Received on Sun Oct 29 2000 - 11:51:28 CET

Original text of this message