This is a more optimal form of a valid request:
SELECT tests.test_name FROM tests LEFT JOIN tests AS tests2 ON tests.test_name = tests2.test_name AND tests2.version = 'ie8' WHERE tests.version = 'ie7' AND tests2.version IS NULL
You see that I added a comparison check for test_name, since without it you say that you will get all tests for ie7 only if there are no ie8 tests.
Subqueries are less efficient than left joins, and this IS NULL state check will give the same result and allow faster processing with a good index.
Andy
source share