subprojects are a different table so it that complicates..
I'm not sure you have them all correct, for instance 99995 and 10050, in fact all of your ones like that have a 5 tolerance on the prior but much more on the post side
Also don't really need the truncate part when we are doing between.
This one though gives this subset
Code:
+----------------------------------+---------------+---------+
| cpid | nick | mycount |
+----------------------------------+---------------+---------+
| e33013c782482e80caf0c65b476a2d87 | JayPi | 24 |
| 476d777382a3555be83f6af9ab59c9f9 | Szopler | 22 |
| 61c4eaaca6667bc9dda3412188c5f173 | x3mEn | 18 |
| 0dd9749ec16c8900f065d871290156bc | BAR | 18 |
| 5dad1593a3bd6cd31ce4a9b507ba20fc | Ananas | 12 |
| 3bfe3268986a7fe9ebaa5acc02e69393 | somanyroads | 9 |
| 7907e81b12e62de3e9a0c5459a973318 | Mark Gallaher | 9 |
| 5ce7cfc3ff8b21f50b0eb24a7d29ffcd | FourOh | 9 |
| d7a3d9afaf379c6984d47f1d9672f5e2 | UL1 | 8 |
| 8e0b099acd93adc95684151a4eef9b86 | Bruce Kennedy | 7 |
+----------------------------------+---------------+---------+
10 rows in set (21.496 sec)