I'm trying to set up a system that has a parent and 8 children. I've done this by having a table of user_id and tier_id. Now I need to get a list of all the tier_id's that appear less than 8 times, so I know that tier is incomplete and then I can go to another list and get replacements.
SELECT * FROM tiers WHERE COUNT(SELECT tier_id) < 8;
I know this isn't right, but maybe it can help explain to a genius what I'm trying to do.
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
SELECT
*
FROM
tiers
WHERE
COUNT(SELECT
tier_id) < 8