php - Question Mark is occured on Laravel query -
i'm trying run code below in laravel $posts= db::table('rmm')
->select( array('message', db::raw('count(message) number'), db::raw('rmm.receivedtime time'))) ->join( 'rcs', 'rmm.smscid', '=', 'rcs.smscid', 'inner') ->where(db::raw('rcs.status =1 , rmm.receivedtime > \'2012-12-26\' , rmm.receivedtime \'2013-04-01\' , length(\'message\') >\'3\' ')) ->group_by('message') ->get();
and got error code below
sqlstate[42000]: syntax error or access violation: 1064 have error in sql syntax; check manual corresponds mysql server version right syntax use near '? group
message
' @ line 1
sql: select `message`, count(message) number, rmm.receivedtime time `rmm` inner join `rcs` on `rmm`.`smscid` = `rcs`.`smscid` rcs.status =1 , rmm.receivedtime > '2012-12-26' , rmm.receivedtime '2013-04-01' , length('message') >'3' ? group `message` bindings: array ( 0 => null, )
somehow produces ?
on query; i'm sure work if solve ?
try raw_where()
:
->raw_where("rcs.status = 1 , rmm.receivedtime > '2012-12-26' , rmm.receivedtime '2013-04-01' , length('message') > 3")
Comments
Post a Comment