Hi. This is an old problem I'm revisiting. But I'm going to restate the problem in a simpler way. Lets say this is my table:
+-ID-+--COLOR----+
| 1 | RED |
| 1 | BLUE |
| 1 | YELLOW |
| 2 | GREEN |
| 3 | GREEN |
| 3 | BLUE |
| 4 | GREEN |
| 4 | ORANGE |
| 4 | GREY |
| 4 | PURPLE |
| 5 | BLACK |
| 6 | WHITE |
| 6 | WHATEVER |
| 7 | COLOR |
| 7 | COLUMN |
| 7 | NOT |
| 7 | IMPORTANT |
| 8 | IN |
| 9 | THIS |
| 10 | EXAMPLE |
+----+-----------+
Thats my table. I want a way to count the unique items, using a threshold. In plain english, I want to know how many unique IDs there are, only counting IDs that have more than X entries in the table. For example, if X was 1, the result would be 5, because there are 5 IDs that have more than one entry in the table.
if X was 2, the result would be 3, because there are 3 IDs that have more than 2 entries in the table.
I have no idea how to accomplish this. But this is just an example, once I know how to count in this way, this is going to be tacked on to a much more complicated query.