• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
In aggregated without GROUP BY error

#1
Hi all,

I have recently updated my local WAMP testing platform to version 3 (I know, bad mistake).  Something that was previously working fine is now coming up with this big error and I really don't know what it means.

This is what is in the controller:

PHP Code:
$data['this_month_uniques'] = $this->Analytics_model->get_month_page_views('0 months'true'unique_hits'); 


This is what is in the model:

PHP Code:
   public function get_month_page_views($month_num$total false$column){
    $pm = (int) date('n'strtotime($month_num));
    $pmy = (int) date('Y'strtotime($month_num)); 
    $this
->db->select('*');
    $this->db->from('analytics_page_views');
    $this->db->where('MONTH(date)'$pm);
    $this->db->where('YEAR(date)'$pmy);
    if ($total == 'true'){
    $this->db->select_sum($column);
    }
    $query $this->db->get();
    if ($total == 'true'){
    return $query->row();
    } else {
    return $query->result();    
    
}
    
  


This is the error that I am getting

Quote:Error Number: 1140

In aggregated query without GROUP BY, expression #1 of SELECT list contains nonaggregated column 'project.analytics_page_views.id'; this is incompatible with sql_mode=only_full_group_by

SELECT *, SUM(`page_hits`) AS `page_hits` FROM `analytics_page_views` WHERE MONTH(date) = 2 AND YEAR(date) = 2017

Filename: C:/wamp/www/system/database/DB_driver.php

Line Number: 691


Can anyone help please with understanding this error?

Thanks,
Doomie
Reply

#2
I had the same issue, see the following answer for a well-put explanation:
http://stackoverflow.com/a/38551525
Reply

#3
I have been looking at this post but I just cannot understand what it really means and how I can fix it Sad
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.