短くてシンプル: COUNT DISTINCT : SELECT screenWidth, COUNT(DISTINCT user_id) FROM mytable GROUP BY screenWidth;