select - 为什么 select count distinct 在 yii 中不起作用?

标签 select yii distinct

有人可以告诉我为什么这不起作用,我的意思是 select distinct 不起作用,它没有正确计数;

$count_participants = BridgeMeeting::Model()->with('idUserRegistry')->count(array(
    'condition' => 'id_meeting=:id_meeting',
    'select' => 'id_user_registry',
    'distinct' => true,
    'params' => array(
        "id_meeting" => $data->id_meeting
    ),
        ));

最佳答案

$count_participants = BridgeMeeting::Model()->with('idUserRegistry')->count(array(
    'condition' => 'id_meeting=:id_meeting',
    'select' => 'id_user_registry',
    'distinct' => true,
    'params' => array(
        ":id_meeting" => $data->id_meeting
    ),
        ));

参数名称也应该是 :id_meeting

关于select - 为什么 select count distinct 在 yii 中不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15407767/

相关文章:

html - 文本缩进和填充不适用于跨浏览器选择

java - Java 中的 SELECT 类似 "if Value of previous Month is negative, do sum of Value of the typed Month and the Value of the previous one"

SQL Server DISTINCT 分页与 ROW_NUMBER() 不不同

git - 使用 Git 管理 Yii 应用程序

php - 解析 PUT 请求的参数时出错

mysql - 如何避免截然不同

oracle - 如何在oracle中创建带条件的不同类型

mysql - SQL 查询,查询到来自不同表的单个字段名称

MySQL UNION SELECT 在几列上查找 MAX 中的 MAX

php - 如何在 Yii2 中仅使用 1 个连接查询来获取多 ActiveRecord 模型?