sql server query with multiple cte example