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
On Wednesday 01 December 2004 17:53, Ross Honniball wrote:
If someone can give me a good reason why this is so, it will stop it
annoying me so much.
I'm sure someone on the _MYSQL_ list will give you a jolly good reason or two.
--
Jason Wong - Gremlins Associates - www.gremlins.biz
Open
twice
In any case it good personal hygiene to use aliases
Ignatius
_
- Original Message -
From: Ross Honniball [EMAIL PROTECTED]
To: php DB [EMAIL PROTECTED]
Sent: 01 December 2004 10:53
Subject: [PHP-DB] Use of 'as' name in where sub-clause
Hi All,
In MySql
to use an alias in
your WHERE clause without doing a sub-select, let me know. :)
-TG
-Original Message-
From: Ross Honniball [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 01, 2004 4:54 AM
To: php DB
Subject: [PHP-DB] Use of 'as' name in where sub-clause
Hi All,
In MySql
Ross,
If someone can give me a good reason why this is so, it will stop it
annoying me so much.
From the MySQL manual for version 4.0.16:
It is not allowed to use a column alias in a WHERE clause, because the column
value may not yet be determined when the WHERE clause is executed. See