[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

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

Posted on 2000-05-03
3
Medium Priority
?
435 Views
Last Modified: 2008-03-06
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
0
Comment
Question by:xander031
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Accepted Solution

by:
AlexJ030200 earned 150 total points
ID: 2774589
Hi xander031,

Try replacing mnth by its definition in the conditions of the query:

select sum( subtotal ) as sales_summary,
datediff ( mm,  'Jan 1 2000', order_date ) as mnth
from sales_order
where datediff ( mm,  'Jan 1 2000', order_date ) > 0
group by datediff ( mm,  'Jan 1 2000', order_date )
0
 

Author Comment

by:xander031
ID: 2774686
I wonder whether the query optimizer will eliminate redundant calls of the function?
0
 
LVL 2

Expert Comment

by:AlexJ030200
ID: 2774711
Sure it will, as long as they are written identically.
0

Featured Post

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever run into that annoying problem where the computer won't boot?  Wouldn't it be great if you had a tool that would make that disk boot again?  I have found one tool that works more often than not ...
It’s time for spooky stories and consuming way too much sugar, including the many treats we’ve whipped for you in the world of tech. Check it out!
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question