は、私は、MySQLQueryBuilderにSQLリクエストを入れて、 ``を避けるには?
SELECT * FROM pt WHERE id=98 ORDER BY FIELD (position, 4, 3, 2, 1, 5)
で、このSQL要求を持っていると私はYii2でクエリを作成する必要があります。私は
'query' => Pt::find()->where(['id' => $model->id])
->OrderBy('FIELD (`position`, 4, 3, 2, 1, 5)')
を書くとき、私はリクエストに ``避けるために、どのように
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 20' at line 1
The SQL being executed was: SELECT * FROM `pt` WHERE `id`=98 ORDER BY FIELD (`position`, `4`, `3`, `2`, `1`, `5)` LIMIT 20
を受けますか?
てみ ' - > [並べ替え( 'FIELD(位置、4、3、2、1、5)')' – RiggsFolly