• I got it wrong because I overlooked the semicolon.

    I was focusing more on the use of subqueries with count in a query, which I thought was the point of this question.

    Need an answer? No, you need a question
    My blog at https://sqlkover.com.
    MCSE Business Intelligence - Microsoft Data Platform MVP