query problem |
here is my model
PHP Code: function get($where = [],$like = [],$order = '',$group_by = [],$type = 'array'){ here is my challenge in the controller PHP Code: $this->M_usr->get(['fb_usr.id_sc' => $this->input->post('school_id'),'fb_usr.id_cl !=' => 0,'fb_usr.id_sc !=' => ''], [], 'fb_classes.name_cl ASC', ['fb_usr.id_cl']); here's the error Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'admin_codeignite.fb_usr.id_fb_us' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by SELECT `fb_usr`.`id_fb_us` as `id_fb_us`, `fb_usr`.`fname` as `fname`, `fb_usr`.`lname` as `lname`, `fb_usr`.`sname` as `sname`, `fb_usr`.`fio` as `fio`, `fb_usr`.`email` as `email`, `fb_usr`.`phone` as `phone` FROM `fb_usr` LEFT JOIN `fb_cities` ON `fb_cities`.`id_ci` = `fb_usr`.`id_ci` LEFT JOIN `fb_classes` ON `fb_classes`.`id_cl` = `fb_usr`.`id_cl` LEFT JOIN `fb_person` ON `fb_person`.`id_pe` = `fb_usr`.`id_pe` LEFT JOIN `fb_posts` ON `fb_posts`.`id_po` = `fb_usr`.`id_po` LEFT JOIN `fb_schools` ON `fb_schools`.`id_sc` = `fb_usr`.`id_sc` LEFT JOIN `fb_key` ON `fb_key`.`id_fb_us` = `fb_usr`.`id_fb_us` WHERE `fb_usr`.`id_sc` = '18' AND `fb_usr`.`id_cl` != 0 AND `fb_usr`.`id_sc` != '' GROUP BY `fb_usr`.`id_cl` ORDER BY `fb_classes`.`name_cl` ASC (07-02-2019, 08:01 AM)php_rocs Wrote: @midav, on my MySql 5.7 if it is disabled ONLY_FULL_GROUP_BY (07-02-2019, 10:04 AM)php_rocs Wrote: @ midav, I have access, the problem is that I do everything on my hosting and the parameter only_full_group_by is disabled there and it is enabled on the customer's server, I googled a lot but didn’t find an example of how to do it on the SQL92 specification on SQL99. A lot of text and there is no example of standing.
here is another example of my SQL92 specification request
PHP Code: $this->db->select('fb_usr.id_ci AS id_ci, fb_usr.id_sc AS id_sc, fb_usr.id_cl AS id_cl, COUNT(fb_usr.id_us) AS count'); with only_full_group_by disabled, everything works fine, but when only it turns on all the error is the same again. Can someone show how to fix my query on the SQL 99 specification.
[quote pid='365734' dateline='1562061900']
here's the error Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregated column 'admin_codeignite.fb_usr.id_fb_us' which is not functionally dependent on columns in GROUP BY clause; this is incompatible with sql_mode=only_full_group_by [/quote] as error says you need to disable only_full_group_by https://stackoverflow.com/questions/2392...l-group-by I faced the same error, fixed it by disabling only_full_group_by mode. Disabling should not break your existing queries, in my case I did not face any problems. (07-04-2019, 05:52 AM), midav Wrote: here is another example of my SQL92 specification request @midav, you can disable the mode only_full_group_by in you customer server. in your CI model : $this->db->query("SET session sql_mode=''"); OR if you don't use the primary key in your group by clause, you can use any_value in your query: select any_value(fb_usr.id_ci), any_value(your_column), etc.... if you use a primary_key in your group by clause, there is no problem. |
Welcome Guest, Not a member yet? Register Sign In |