In code Keith provided, substitute the literal 4000 with<code> (SELECT the_count_I_want FROM what_I_say WHERE blah_blah) </code> Or, substitute that inner query with whatever floats your boat.
In code Keith provided, substitute the literal 4000 with<code> (SELECT the_count_I_want FROM what_I_say WHERE blah_blah) </code> Or, substitute that inner query with whatever floats your boat.