Alias and Where clause problem

Tech-Archive recommends: Speed Up your PC by fixing your registry

From: David (david.parenteau_at_compuware.com)
Date: 04/01/04


Date: Thu, 1 Apr 2004 12:40:18 -0800

Why I can't use alias name in a where clause? Does a work
around exist?

The reason I want to use alias is that the field (id in
the following example) could by a long expression.

SELECT id as myID
FROM table1
WHERE myID = 1



Relevant Pages

  • Re: To *DEEV* aka Farid Royhani aka Koskesh the financial profeteer
    ... beyond your comprehension. ... I simply asked why you use an alias and you went on with ramblings ... > What you fail at is not the reason for the alias, but why you choose to write under an alias.I ... >> corner and are now grasping at straws... ...
    (soc.culture.iranian)
  • Re: Aliases and the WHERE clause
    ... The one hope we could hold is that future releases of engines will build on ... To me, SQL also feels just like a set of principles, or if you wish, mental ... I was thinking about the ORDER BY clause. ... alias in the WHERE clause. ...
    (microsoft.public.access.queries)
  • Trying to find a maximum value amongst 3 columns in a dB row
    ... The column prefix 'a1' does not match with a table name or alias name ... used in the query. ... Either the table is not specified in the FROM clause ...
    (comp.databases.sybase)
  • Re: How does UPDATE statement work?
    ... It cannot have an alias because an alias ... You go to the WHERE clause. ... disaster in the ANSI model and in implementation, ... Trying to UPDATE the temporary result of a JOIN syntax would be ...
    (comp.databases.ms-sqlserver)
  • Re: Parameter Query on an expression
    ... It is because you CANNOT USE ALIAS in the WHERE clause, but have to repeat the expression the alias stands for. ... but two levels of alias: LotsAcc depends on CountOfqtrce which is itself an alias for a computed expression. ... Furthermore, since the computed expression involves aggregate, some of the criteria have to be moved in the HAVING clause. ... I would expect it to determine what the "Profit"> value ...
    (microsoft.public.access.queries)