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.

PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to