Re: NOT IN for Multuple Values
Posted by:
Rick James
Date: February 02, 2016 10:03PM
That's an awfully inefficient way to perform the query.
Instead of
FROM x
WHERE CONCAT(a,b) NOT IN ( SELECT CONCAT(a,b) FROM z ... )
do
FROM x
LEFT JOIN z ON z.a = x.a AND z.b = x.b
WHERE z.id IS NULL
Also don't CONCAT like that in the WHERE clause, it eliminates the possibility of using an index.
WHERE CONCAT(a,'-',b) = 'P-7943'
-->
WHERE a = 'P' AND b = '7943'
and then have INDEX(a,b) (in any order)
Subject
Written By
Posted
February 02, 2016 11:44AM
February 02, 2016 12:48PM
February 02, 2016 06:56PM
Re: NOT IN for Multuple Values
February 02, 2016 10:03PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.