>HI
>
>I have
>
>
>select s.*
>from sat_labellist s
>join all_inner_london_postcodes a
>on Replace(s.postcode, ' ', '')= a.postcode
>join member
>on s.[membership no] = member.membership_no
>where a.area = 'Lambeth'
>and s.type = 'Group'
>and LEN(s.[private email]) = 0
>and member.individual_ref NOT IN (SELECT individual_ref from attribute where attribute.attribute_code = 'NOMAIL')
>
>
>if I don't have the sub query at the end I get 340 rows
>if I use IN or NOT IN on the sub query I get 0 back.
>
>Shouldn't I get a total of 340 either way.
>
>I'm trying to not select lines with an attribute of NOMAIL
>
>Thanks
Take a look at this blog post
Why you should never use IN/NOT IN in SQLI suggest to change your query to not exists.
If it's not broken, fix it until it is.
My Blog