简体   繁体   English

Zend数据库得到了重要性

[英]Zend Database get count

I have a query to count all rows in Db table. 我有一个查询来计算Db表中的所有行。

$results = $db->fetchAll('select count(id) as total_keys, sum(if(used,1,0)) as used_keys from product_keys');
$this->_helper->flashMessenger->addMessage($results);

I want to get the total_keys and used_keys, but it doesn't seen to work. 我想得到total_keys和used_keys,但它看起来没有用。

$results = $db->fetchOne('select count(id) as total_keys, sum(if(used,1,0)) as used_keys from product_keys');
$this->_helper->flashMessenger->addMessage($results);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM