Welcome Guest, Not a member yet? Register   Sign In
query problem
#10

(07-04-2019, 05:52 AM), midav Wrote: 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');
 
       $this->db->where(['fb_usr.id_ci !=' => '''fb_usr.id_sc !=' => '''fb_usr.id_cl !=' => 0]);
 
       $this->db->from('fb_usr');
 
       $this->db->group_by(["fb_usr.id_sc""fb_usr.id_cl" ]);  // Производит: GROUP BY title, date
 
       $query $this->db->get();
 
       $rez $query->result_array(); 

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.

@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.
Reply


Messages In This Thread
query problem - by midav - 07-02-2019, 03:05 AM
RE: query problem - by hc-innov - 07-02-2019, 05:37 AM
RE: query problem - by midav - 07-02-2019, 07:12 AM
RE: query problem - by php_rocs - 07-02-2019, 08:01 AM
RE: query problem - by midav - 07-02-2019, 08:22 AM
RE: query problem - by php_rocs - 07-02-2019, 10:04 AM
RE: query problem - by midav - 07-04-2019, 05:48 AM
RE: query problem - by midav - 07-04-2019, 05:52 AM
RE: query problem - by hc-innov - 07-04-2019, 08:59 AM
RE: query problem - by neuron - 07-04-2019, 08:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB