php - mySQL query complicated join producing random and erroneous number -


the following code supposed find electors not have postal vote, have telephone number not in possession of codes listed in table called voting intentions pledges or not listed in table @ all.

from electors,voting_intention    electors.telephone > 0    , electors.postal_vote != 1    , (     electors.mosaic not in ('e1','e2','e3')      or (       electors.id = voting_intention.elector        , voting_intention.pledge in ('u','w','x')     )      or electors.id != voting_intention.elector   ) 

at moment producing count of on 2 million records many times number in database. wrong can't see error.

from electors e         left join voting_intention v1 on e.id = v1.elector , v1.pledge in ('u','w','x')          left join voting_intention v2 on e.id = v2.elector      e.telephone > 0  , e.postal_vote != 1 /* not have postal vote?? */ , (e.mosaic not in ('e1','e2','e3')       or v1.elector not null      or v2.elector null) 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -