0

I'm trying to get the number returned by the SQL statement to be formatted, so basically to contain commas once the number is in the thousands.

$countsQuery = (new yii\db\Query())
            ->SELECT FORMAT(COUNT(['CS']), N'#.00')
            // ->select(['COUNT(*) AS count, `CS`'])
            ->from(TaggedData::tableName())
            ->leftJoin(SurveyInstance::tableName(), 'survey_instance_id = survey_instance.id');

What am I doing wrong? the SQL statement works without me trying to format it. the error I am getting is

'syntax error, unexpected 'FORMAT' (T_STRING'

0 Answers0