我有下一个声明:
$lead_count = $this->Lead->find("list", array("conditions" => array("chosen_country_id" => $countries, "lead_type" => "Consumer"),
"fields" => array('Lead.status', 'count(Lead.id)'),
"group" => "Lead.status"));
此声明中形成的查询是:
SELECT "Lead"."status" AS "Lead__status", count("Lead"."id")
FROM "public"."leads" AS "Lead"
WHERE chosen_country_id IN (167, 201, 203, 39) AND "lead_type" = 'Consumer'
GROUP BY "Lead"."status"
如果我在数据库上手动运行此查询,结果为:
Lead__status | count
-----------------------------+-------
Contacted | 1
Assigned to lead dispatcher | 1
On call | 3
Sent to Distributor | 1
Call attempted 1 | 1
New | 241
Mark as invalid | 1
但在我的网页上,结果是:
阵列(
'Contacted' => null,
'Assigned to lead dispatcher' => null,
'On call' => null,
'Sent to Distributor' => null,
'Call failed 1' => null,
'New' => null,
'Mark as invalid' => null
)
任何想法为什么?
由于