Use of 'as' name in where sub-clause

From: Date: Wed, 01 Dec 2004 09:53:32 +0000
Subject: Use of 'as' name in where sub-clause
Groups: php.db 
Request: Send a blank email to php-db+get-37481@lists.php.net to get a copy of this message
Hi All, In MySql, you CAN'T do the following: SELECT sales * cost AS total WHERE total > 100 Instead, you need to say: SELECT sales * cost AS total WHERE sales * cost > 100 I'm just curious WHY you can't do it. You can, for example, specify ORDER BY total. I can't think of any reason why it would be either difficult or ambiguous for the SQL engine to allow you to use your calculated field name in the WHERE part of the query. If someone can give me a good reason why this is so, it will stop it annoying me so much. Regards ... Ross . . Ross Honniball. JCU Bookshop Cairns, Qld, Australia. .

« previous php.db (#37481) next »