List:General Discussion« Previous MessageNext Message »
From:Massimo Colurcio Date:May 29 2002 9:09pm
Subject:Alias & WHERE
View as plain text  
It seems I cannot use an alias in WHERE clause, but I can use it in ORDER BY.

An examples:

this doesn't work
SELECT field1 AS ABC, field2 AS XXX, field3 AS QQQ FROM mytable WHERE ABC = 
'abc' ORDER BY ABC

this works
SELECT field1 AS ABC, field2 AS XXX, field3 AS QQQ FROM mytable WHERE 
field1 = 'abc' ORDER BY ABC

Why I cannot use the alias 'ABC' in WHERE clause and I can use it in ORDER 
BY clause?

I'm using mySQL 3.23.47 on W98 with ODBC (myODBC 3.51.02).

TIA,
Massimo.

_______________________________________
Massimo Colurcio
mailto:m.colurcio@stripped
http://www.softhor.com/developmentarea
ICQ #96413649
ATIC #1219
SONORK 100.10862

Thread
Alias & WHEREMassimo Colurcio29 May
  • RE: Alias & WHEREGurhan Ozen29 May