Tag Info

New answers tagged


This should do the trick. SELECT COUNT( * ) AS `how much` , `name` , `location` FROM table WHERE name NOT IN (SELECT name FROM table WHERE location = 'y') GROUP BY `name` ORDER BY `name` The idea behind this is : we are counting the number of name but we have to exclude rows of name where in ANOTHER row there is location = 'y'. If you do WHERE ...

Top 50 recent answers are included