Re: [PHP-DB] Use of 'as' name in where sub-clause

2004-12-01 Thread Jason Wong
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

Re: [PHP-DB] Use of 'as' name in where sub-clause

2004-12-01 Thread Ignatius Reilly
Very simply, because a clause WHERE sales * cost 100 would look up to sales and cost in the expression as SELECT fields. Your clause will wotk if you add sales and cost to the SELECT fields, but that would not be economical: - you don't need them in the result - you will execute the caclulation

RE: [PHP-DB] Use of 'as' name in where sub-clause

2004-12-01 Thread Gryffyn, Trevor
Yeah, I've asked this question myself a million times. It'd be very useful and maybe some DB system knows how to do this, but for the most part you just have to deal with this reality. I believe that it's a matter of timing, really. You can't use the alias in the WHERE clause because it hasn't

Re: [PHP-DB] Use of 'as' name in where sub-clause

2004-12-01 Thread dpgirago
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