I have this query, which is the only query containing a total of 3 SELECT:
SELECT a FROM tbl WHERE b IN ((SELECT a FROM tbl WHERE b = 44)) AND NOT a IN ((SELECT a FROM tbl WHERE b = 44))
Request
SELECT a FROM table WHERE b = 44
exactly the same thing, and I assume that the database runs 2 times, although it should be faster the second time due to caching, etc.
Is there a SQL method or something specific for MySQL that I can do to reuse 100% of the results of the first query that is executed?
Or any other ideas on how to speed up this query?
I am using MySQL 5.7.
source share