| Return To Topics |
Originally Posted: 6/23/2006 7:27:18 PM |
| |
Last Updated: 6/23/2006 7:41:25 PM |
Subject:
DailyChallenge 06/22/2006
You Asked....
I got today's question wrong and had a reference which seems to suggest I might have been right or that the question might be ambigious :
Source : http://publib.boulder.ibm.com/infocenter/rb63help/index.jsp?topic=/com.ibm.redbrick.doc6.3/ssg/ssg32.htm
A column alias can occur anywhere in a SELECT statement to designate the column to which it refers (for example, in a WHERE, ORDER BY , GROUP BY, or HAVING clause).
Important:
If the value contained in the column referenced by the column alias is the result of a set function, it cannot occur in the WHERE clause; however, it can occur in the HAVING clause.
Can you mail me for a clarification.
Question:
When a column is aliased in a SQL statement which of the following can utilize the column alias rather than having to use the names of the column from the table?
Example:
SELECT quantity*discount extprice FROM OrderDetails
and we responded....
I read your reference and you are correct.
However, this seems to be specific to a RedBrick implementation.
ANSI-SQL allows a column alias to be used on the ORDER BY clause but not on the HAVING, GROUP BY or WHERE.
|