Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Why is my query not working
Message
De
13/06/2011 09:41:15
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01514209
Message ID:
01514212
Vues:
53
Thanks sergey

the postcode in one file has an embedded space and it doesn't in the other file



>Make sure that subquery does not return NULLs.
>
>SELECT individual_ref from attribute where attribute.attribute_code = 'NOMAIL'
>   AND individual_ref  IS NOT NULL
>
>
>BTW, what Replace(s.postcode, ' ', '') is for?
>
>>
>>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform