2
我使用Zend框架,不能写在模型旁边的SQL查询编写组:Zend框架 - 如何通过查询
SELECT `id_user`,`system_role`,count(`system_role`)
FROM `favorites`
group by `id_user`,`system_role`
如何做到这一点?
我使用Zend框架,不能写在模型旁边的SQL查询编写组:Zend框架 - 如何通过查询
SELECT `id_user`,`system_role`,count(`system_role`)
FROM `favorites`
group by `id_user`,`system_role`
如何做到这一点?
$db = new Zend_Db_Table('favorites');
$select = $db->select()
->from('favorites', array('id_user', 'system_role', 'COUNT(system_role)'))
->group('id_user', 'system_role');
谢谢garvey – kruksmail 2011-12-27 13:48:40
没问题。你可以标记我的答案为接受:) – pltvs 2011-12-27 14:52:12