PeterErhard
asked on
Group By on Derived Field
I've got the following query:
select
datename(month,log_date) + ' ' + datename(year,log_date) as CalcDate,
COUNT(*)
from
logging
group by
CalcDate
When I try to run it however, I get:
Msg 207, Level 16, State 1, Line 4
Invalid column name 'CalcDate'.
How am I able to group by CalcDate to get my desired result?
select
datename(month,log_date) + ' ' + datename(year,log_date) as CalcDate,
COUNT(*)
from
logging
group by
CalcDate
When I try to run it however, I get:
Msg 207, Level 16, State 1, Line 4
Invalid column name 'CalcDate'.
How am I able to group by CalcDate to get my desired result?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.