The WHERE clause was comparing Code to itself instead of the aliased table reference, which would always be true.