Thank you Malleswarareddy, for the answer.
To answer your question, Calibear, below is DDL demonstrating my reason for needing to UNION ALL two CTEs.
New DDL
create table #temp (TicketID int, Name varchar(20), Duration int)
insert into #temp
values
(10, 'Helen', 8),
(15, 'Blake', 12),
(20, 'Joe', 17),
(25, 'Joe', 16),
(30, 'Blake', 50),
(35, 'Helen', 20);
From this data I must produce a report showing two additional columns: Category, Value which label and summarize how many tickets were filed, per Name and the Duration of the tickets per Name. Like this:
;with ct1 as
(select
name
,Value = COUNT(ticketID)
from #temp
group by Name
)
select
name
, Value
, Category = 'Count'
from ct1
-------
;with ct1 as
(select
name
,Duration
from #temp
)
select
name
, Value= (Select sum(Duration))
, Category = 'Duration'
from ct1
group by name
-----
Ideally, I could gets counts and duration by Name, with correct corresponding entry in Category column, with just one query, but I don't know how...so I've used CTEs.