var sidebar_align = 'right';
var content_container_margin = parseInt('290px');
var sidebar_width = parseInt('270px');
Unanswered: Using alias in WHERE
I've an SQL as follows:
SELECT ROUND((correct/completed) * 100, 2) AS percent_score FROM records WHERE member_id=10 AND percent_score > 50.00;
I get the error ERROR 1054 (42S22): Unknown column 'percent_score' in 'where clause'
How do I make the second condition "percent_score > 50.00" work?
Looking forward to your replies
Since the column is calculated in the select, there is no way to have it included in your where clause. What you can do is materialize that resultset, then you can query it. Something like:
from (SELECT ROUND((correct/completed) * 100, 2) AS percent_score
FROM records WHERE member_id=10) as a
where percent_score > 50.00;
Thank you so much, Dave
It works now