how to set sql_mode for a query in CI model 1

how to set sql_mode for a query in CI model

$this->db->query('SET SESSION sql_mode = ""');

// ONLY_FULL_GROUP_BY
$this->db->query('SET SESSION sql_mode =
                  REPLACE(REPLACE(REPLACE(
                  @@sql_mode,
                  "ONLY_FULL_GROUP_BY,", ""),
                  ",ONLY_FULL_GROUP_BY", ""),
                  "ONLY_FULL_GROUP_BY", "")');

Here is what the above code is Doing:
1. It’s setting the sql_mode to an empty string.
2. It’s replacing the ONLY_FULL_GROUP_BY string with an empty string.

Similar Posts