Misleading comment ;) The IS NOT NULL isn't in the inner select anymore. You should replace by the HAVING instead