Can anyone tell me if the following query can be done?
mysql_query("SELECT a, b, (a+b) AS c FROM table WHERE c=1");
When I try this I get an unknown column error for c. In order to get the query to work I have had to do this
mysql_query("SELECT a, b, (a+b) AS c FROM table WHERE (a+b)=1");
This is dramatically simplified from my actual query in which c is calculated using over 10 fields and multiple where clauses. In the end, in order to get this to work, my query string is very long. It seems the first bit of code should work. I shouldn't have to do the same calculation 2 times in the same query.
I have heard some discussion on the MySQLi. Would this advanced query method be able to handle requests like this?