Still at it....
Date: 07/21/05
(MySQL Communtiy) Keywords: no keywords
$Query = "SELECT invoice_number, sum(((TIME_TO_SEC(end_time) - TIME_TO_SEC(start_time))/3600) * rate) FROM invoice_items GROUP BY invoice_number HAVING office_id='$office_id' AND service_type!='225' ORDER BY invoice_number";
Error: Unknown column 'office_id' in 'having clause'
However, office_id is a column. And the query works if I remove sum, GROUP BY, and change HAVING to WHERE.
More on the time conversion
Source: http://www.livejournal.com/community/mysql/63088.html