$query = $this->db->group_by('hs_tktno');
$query = $this->db->where('hs_toid', $id);
$query = $this->db->order_by('hs_id', "desc");
$query = $this->db->get('table');
$data["list"] = $query->result();
Im Getting the following error when i try to excute the above code any ideas?
Error Number: 1055
'dbname.table.hs_id' isn't in GROUP BY
SELECT * FROM (
table
) WHEREhs_status
= '0' GROUP BYhs_tktno
Didn't understood much by question, but your query written is wrong. It should be like this,
$this->db->group_by('hs_tktno');
$this->db->where('hs_toid', $id);
$this->db->order_by('hs_id', "desc");
$query = $this->db->get('table');
return $query->result();
I also had this issue, the solution that I found was to change your my.cnf or my-default.cnf in your server. For my case, I am using mac, this file can be found at /usr/local/mysql/support-files/
Steps to produce solution:
cd /usr/local/mysql/support-files/
sudo vim my.cnf
sql_mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
:wq
to save and close vim sudo /usr/local/mysql/support-files/mysql.server restart
or sudo service mysql restart
For some who couldn't find their my.cnf file. Please refer to this for Mark B answer. This will help you to find your my.cnf .
If you only have my-default.cnf, you could just copy it to ~/.my.cnf with the command sudo cp /usr/local/mysql/support-files/my-default.cnf ~/.my.cnf
and remember to restart after that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.