我正在尝试在 Laravel $posts= DB::table('rmm') 中运行以下代码
->select( array('message', DB::raw('COUNT(message) as number'), DB::raw('rmm.receivedTime as time')))
->join( 'rcs', 'rmm.smsCid', '=', 'rcs.smsCid', 'INNER')
->where(DB::raw('rcs.status =1 and rmm.receivedTime > \'2012-12-26\' and rmm.receivedTime LIKE \'2013-04-01\' and length(\'message\') >\'3\' '))
->group_by('message')
->get();
并得到下面的错误代码
SQLSTATE[42000]:语法错误或访问冲突:1064 您的 SQL 语法有错误;检查与您的 MySQL 服务器版本相对应的手册,以获取在 '? 附近使用的正确语法。GROUP BY
message
' 在第 1 行
SQL: SELECT `message`, COUNT(message) as number, rmm.receivedTime as time FROM `rmm` INNER JOIN `rcs` ON `rmm`.`smsCid` = `rcs`.`smsCid` WHERE rcs.status =1 and rmm.receivedTime > '2012-12-26' and rmm.receivedTime LIKE '2013-04-01' and length('message') >'3' ? GROUP BY `message`
Bindings: array (
0 => NULL,
)
它以某种方式?
在查询中产生;如果我解决了这个问题,我确定它会起作用吗?