That's a limitation in FM-esql. Aggregates can't be processed further by another sql-function.
I handle this either by a CF to after-process the result
fill a VirtualList with the first query COUNT only and do a second query for marking on the VirtualList-TO.
Thank you for you quick answer and suggestion