I need to write a query that will count members in top 5 states. It must check that the state is in array
$myStates = array("AL","AZ","CA","CO","CT","DC","DE","FL");
I was thinking something along the lines:
SELECT count(state_id) AS stateCOUNT, state_name
FROM t1
WHERE state_name IN (".$myStates.")
GROUP BY state_name
ORDER BY stateCOUNT
LIMIT 5
I keep getting the states with single values althrough there are many states that have multiple listings...