I was debugging a stored procedure the other day and found some logic something like this:
SELECT something FROM someTable WHERE idcode <> (SELECT ids
in some versions of SQL != should be used for a "not equals" logical statement. Have you tried that?