Link to home
Start Free TrialLog in
Avatar of PeterErhard
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?
ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial