|
Posted by Hugo Kornelis on 10/15/05 00:59
On Fri, 14 Oct 2005 21:51:02 +0000 (UTC), Erland Sommarskog wrote:
(snip)
>Keep in mind that you cannot just say:
>
> SELECT ...
> FROM tbl a
> JOIN audit_tbl b ON a.keycol = b.keycol
> WHERE a.col1 <> b.col1
> AND a.col2 <> b.col2
> ...
>
>Correct is:
>
> WHERE (a.col1 <> b.col1 OR
> a.col1 IS NULL AND b.col1 IS NOT NULL OR
> a.col1 IS NOT NULL AND b.col1 IS NULL)
> AND
Hi Erland,
This can be (slightly) simplified to
WHERE (NULLIF (a.col1, b.col1) IS NOT NULL OR
NULLIF (b.col1, a.col1) IS NOT NULL)
AND
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
[Back to original message]
|