I have 2 tables.
$sqlx = "SELECT COUNT(*) AS numberOfRows FROM table2 where name = 'Fred' AND count < '6' AND os = 'iOS' GROUP BY name";
Adding the IN means you will check for all items in this list. Then using the second select query you are just pulling all names from table1. Here you can impose more conditions if you need to.
$sqlx = "SELECT COUNT(*) AS numberOfRows FROM table2 WHERE name IN (SELECT name FROM table1) AND count < '6' AND os = 'iOS' GROUP BY name";