this is my query... i am unable to use aggregate function - count on multiple tables at once.
$qu="SELECT distinct calls.c_number, count(type) as count1,SUM(charges * duration) as total,sum(duration) as duration1,billing_details.payment as pay,packages.(count)activation as act
FROM calls
INNER
JOIN packages
ON calls.c_number=packages.c_number
WHERE
calls.date>= DATE_FORMAT( $date, '%Y/%m/01' ) AND
calls.date< DATE_FORMAT( $date + INTERVAL 1 MONTH, '%Y/%m/01') group by c_number desc having SUM(charges * duration) > 0 ";
it gives me this error:
FUNCTION packages.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
This doesn't have anything to do with PHP...
It's to do with your top line -
$qu="SELECT distinct calls.c_number, count(type) as count1,SUM(charges * duration) as total,sum(duration) as duration1,billing_details.payment as pay,packages.(count)activation as act
What do you expect "packages.(count)activation" to do? Do you mean count(packages.activation)
?
try this
count(packages.activation)
instead of this
packages.(count)activation