codeigniter - getting error Call to a member function result() on boolean when i try to use group_by function in codeigniter
问题描述
When i try to use group_by function select query not working, and i am getting error Call to a member function result()
, without group by query is working, i can't fix this issue ? can anyone please help me to resolve this issue ? here i have added my whole query
$query = $this->db->select('s.*,b.*,c.*,i.*')
->from('sales s')
->join('biller b','s.biller_id=b.biller_id','inner')
->join('customer c','s.customer_id=c.customer_id','inner')
->join('invoice i ','s.sales_id=i.sales_id','inner')
->group_by('sales_id');
$data = $query->get()->result();
return $data;
解决方案
My guess is the sales_id
column name on this line is ambiguous :
->group_by('sales_id');
So you could change it either using sales.sales_id
or invoice.sales_id
:
->group_by('s.sales_id');
推荐阅读
- python - 包含来自 PyPi 的 pip 安装库的示例和文档
- java - 如何解决 switch case 语句中的异常处理问题?
- xml - Create custom XML from Access VBA
- java - 与docker上的mysql服务器通信?
- c - Inputing a value and instead of keeping that information in a array, it changes another var
- html - 导航栏显示不正确
- java - Spring ConstraintValidator 设置自定义代码/拒绝值
- vue.js - 如何结合 v-for 和 v-model 来编辑对象列表?
- android-studio - 找不到符号变量 imageView2
- r - Igraph 基于中心性分数识别节点