Php 如何得到一列的和
我想从表中获取查询结果。在“如何获取两列日期和总和(比率)”中 我得到的是表中所有的列,而不是选定的列Php 如何得到一列的和,php,symfony,propel,Php,Symfony,Propel,我想从表中获取查询结果。在“如何获取两列日期和总和(比率)”中 我得到的是表中所有的列,而不是选定的列 $results = VoiceQuery::create() ->select(array('call_date', 'rated_units')) ->withColumn('call_date', 'call_date') ->withColumn('SUM(rated_units)', 'rated_units') -
$results = VoiceQuery::create()
->select(array('call_date', 'rated_units'))
->withColumn('call_date', 'call_date')
->withColumn('SUM(rated_units)', 'rated_units')
->filterByOriginatingCli('1300690045')
->filterByCallDate($week_ago_date, Criteria::GREATER_EQUAL)
->groupBy("call_date")
->limit(10);
我只想选择两列,但根据上面的查询,我得到了所有表列数据。尝试以下操作:
VoiceQuery::create()
->withColumn('SUM(rated_units)', 'sum_rated_units')
->filterByOriginatingCli('1300690045')
->filterByCallDate($week_ago_date, Criteria::GREATER_EQUAL)
->groupBy("call_date")
->select(['call_date', 'sum_rated_units'])
->limit(10)
->find();