Jump to content


This topic is now archived and is closed to further replies.


PHP Query Help Please - Unknown Column

Recommended Posts


Please can someone try and help me with the following query I have to get working for a college assignment:

$query = "SELECT *, sqrt(pow(tblcalc.sum1, 2) + pow(tblcalc.sum2, 2)) / 4 as SUMTOTAL FROM tblsums WHERE SUMTOTAL < $VAR ORDER BY $orderby $sort ";

I have named the sum 'SUMTOTAL' which works fine my problem is when I try to show only 'SUMTOTAL' which is < $VAR the query produces an error "Unknown Column 'SUMTOTAL' in where clause'

I would be very grateful for any advice or help anyone can offer me.

Thank you kindly,


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.