Jump to content


Photo

PHP Query Help Please - Unknown Column


  • Please log in to reply
1 reply to this topic

#1 sportypants

sportypants
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 May 2006 - 10:30 PM

Hello,

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,

JJ

#2 sportypants

sportypants
  • New Members
  • Pip
  • Newbie
  • 2 posts

Posted 10 May 2006 - 10:50 PM

Got it working thank you. Replaced Where with Having and worked fine.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users