Reputation: 378
Here is the query
select *
FROM
WEBSS.P0022_INVENTORY_ACTIVITY_LOG I LEFT OUTER JOIN WEBSS.P0029_LOCATION L2 ON I.INVT_XFER_LOC_ID = L2.LOC_ID,
WEBSS.P0029_LOCATION L
WHERE
I.LOC_ID = L.LOC_ID
UNION ALL
select *
FROM
WEBSS.P0022_INVENTORY_ACTIVITY_LOG I LEFT OUTER JOIN WEBSS.P0029_LOCATION L2 ON I.LOC_ID = L2.LOC_ID,
WEBSS.P0029_LOCATION L
WHERE
I.INVT_XFER_LOC_ID = L.LOC_ID;
Can you plz tell me hw can i use the second query in effective manner.
When you look at the query u can find there is a small change in the condition.. so for that do we really need to go for two queries nwith union all..
I need to tune the second query ie..any possible way to rewrite the second query to make good performance.. any help on this?
Thanks in advance.
Upvotes: 0
Views: 89
Reputation: 431
I am not an expert in db2, but sql statements are generally the same
Upvotes: 1