Haven't yet been acquainted with CTE's. Sounds useful but for queries like these examples the only difference to me is naming sets first instead of while you're defining them. I always build the sets first for a query, only initially selecting the count. After joining / filtering and sets are verified, I go back and select the data of interest - typically I would then convert it to an insert/update/delete.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.