Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

MySQL: WHERE conditions without any effect on SELECT COUNT with several JOINS

Please take a look at this Query:

SELECT COUNT(s.type) AS TSUM, s.type FROM skills s

    JOIN player p            ON p.id            = s.player_id 
    JOIN offers_tags at      ON at.offer_id     = p.offer_id 
    JOIN player_countries pc ON p.id            = ps.player_id
    JOIN countries co        ON co.countrycode  = ps.countrycode 
    JOIN netzwerke n         ON n.id            = p.netzwerk_id

    WHERE at.tag_id = :tag_id

    AND ps.countrycode  IN ('DE', 'AT', 'CH') 
    AND p.active   = 'yes' 
    AND n.active   = 'yes' 
    AND co.active  = 'yes'

    GROUP BY s.type

It works, but all AND conditions take no effect at all.I get the same results when I remove these lines:

AND ps.countrycode  IN ('DE', 'AT', 'CH') 
AND p.active   = 'yes' 
AND n.active   = 'yes' 
AND co.active  = 'yes'

I realy spent al lot of time to solve this, read manuals, SO etc. I'm not able to see the f*** forest for the trees anymore...

I remain like Paul McCartney and John Lennon with a friendly HELP! :-)

Comments