Mysql
 sql >> Database >  >> RDS >> Mysql

Come disabilitare l'opzione only_full_group_by in Laravel

In Laravel, puoi farlo in runtime invece di effettuare un'impostazione globale

//disable ONLY_FULL_GROUP_BY
DB::statement("SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));");

//Your SQL goes here - The one throwing the error (:

//re-enable ONLY_FULL_GROUP_BY
DB::statement("SET sql_mode=(SELECT CONCAT(@@sql_mode, ',ONLY_FULL_GROUP_BY'));");