Link to home
Create AccountLog in
Avatar of xander031
xander031

asked on

group by a computed column didn't work in sybase. why?

In Sybase adaptive server 11, the following gave me 'invalid column name mnth'. How can I summarize sales by month?

select sum( subtotal ) as sales_summary,
  datediff ( mm,  'Jan 1 2000', order_date ) as mnth
from sales_order
where mnth > 0
group by mnth
ASKER CERTIFIED SOLUTION
Avatar of AlexJ030200
AlexJ030200

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of xander031
xander031

ASKER

I wonder whether the query optimizer will eliminate redundant calls of the function?
Sure it will, as long as they are written identically.