>Naomi, Is the first line missing something, since it begins with:
>
>
>;with counts as (select Id, count(Id) as frequency
>
>
>Thanks, Steve
No, nothing is missing here. The Common Table Expression should begin after ; that's why I added ; in front of it.
If it's not broken, fix it until it is.
My Blog