|
|
Archives of the TeradataForum
Message Posted: Tue, 11 Sep 2007 @ 21:24:17 GMT
Subj: | | In WHERE clause multiple equality conditions ORed |
|
From: | | Anomy Anom |
<-- Anonymously Posted: Tuesday, September 11, 2007 14:52 -->
Hello everybody,
In the following SQL statement WHERE clause has multiple equality conditions ORed and Explain plan shows PRODUCT join. When we execute this
query it is spooling out or runs for very long.
Is there any alternative way we can write this query to avoid PRODUCT join.
SEL A.COL1,
A.COL2,
B.COL1,
B.COL2
FROM
Dbase30.TBL1 A
,DBase30.TBL2 B
WHERE
(
(A.COL1= B.COL1 AND A.COL1 NE ' ')
OR
(A.COL2= B.COL2 AND A.COL2 NE ' ')
OR
(A.COL3= B.COL3 AND A.COL3 NE ' ')
OR
(A.COL1 ' ' AND A.COL2 ' ' AND A.COL3 ' ')
) ;
Thanks in Advance
| |