Hi everybody,
I have a DB2 query as follows . Basically it goes for a tablescan for TAB4 which is the table in the
subquery under NOT EXISTS. Can the whole query be replaced using INNER JOIN between TAB1,TAB2,TAB3
and a LEFT OUTER JOIN for TAB4 ? Could anyone help me in this ? Thank you.
SELECT
a.col1 , a.col2 , a.col3
FROM
TAB1 a, TAB2 b,TAB3 c
WHERE
a.col1 = b.col1 AND
a.col2=c.col2 AND
a.col3 = 'X' AND
a.col4 = 'Y' AND
b.col4 = 'M' AND
NOT EXISTS
(
SELECT * FROM TAB4 d
WHERE d.col1 = a.col1 and
d.col6 = a.col6 and
d.col2 = a.col2 and
d.col10 = 'CDE' and
d.col11 >= '1990-05-30'
)
I have a DB2 query as follows . Basically it goes for a tablescan for TAB4 which is the table in the
subquery under NOT EXISTS. Can the whole query be replaced using INNER JOIN between TAB1,TAB2,TAB3
and a LEFT OUTER JOIN for TAB4 ? Could anyone help me in this ? Thank you.
SELECT
a.col1 , a.col2 , a.col3
FROM
TAB1 a, TAB2 b,TAB3 c
WHERE
a.col1 = b.col1 AND
a.col2=c.col2 AND
a.col3 = 'X' AND
a.col4 = 'Y' AND
b.col4 = 'M' AND
NOT EXISTS
(
SELECT * FROM TAB4 d
WHERE d.col1 = a.col1 and
d.col6 = a.col6 and
d.col2 = a.col2 and
d.col10 = 'CDE' and
d.col11 >= '1990-05-30'
)