这是我的查询...我无法使用聚合函数 - 一次计算多个表。
$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 ";
它给了我这个错误:
FUNCTION packages.count does not exist. Check the 'Function Name Parsing and Resolution' section in the Reference Manual
答案 0 :(得分:1)
这与PHP没有任何关系......
这与你的收入有关 -
$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
您对“包裹。(计数)激活”的期望是什么?你的意思是count(packages.activation)
?
答案 1 :(得分:0)
试试这个
count(packages.activation)
而不是
packages.(count)activation