You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a query that selects 4 columns from different tables, I also need to group them
but when whenever i try to group them I get an error on my page
This is the structure of my query
$this->datatables->select(first,second,third,MAX(CASE WHEN id = fid THEN 'T' ELSE 'F' end) as fourth');
->from(tableA);
$this->datatables ->join(......)
-->join(.....)
$this ->datatables->where(tableA.somevalue > 0);
$this->datatables->group_by(first,id,second,third);
I get this following message from my page ( I am using codeigniter for php)
Error Number: 42000
[Microsoft][SQL Server Native Client 10.0][SQL Server]Column 'tableA.BranchId' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
select * from tableA join ..... group by first,id,second,third
As you can notice the error is clearly doing a 'select * from tableA' I don't know why is it doing that
The text was updated successfully, but these errors were encountered:
I have solution, but I don't know how to patch to git. pls follow this instruction
create private variable after line private $order_by, example : private $query
inside private function get_total_results, after if(strlen($this->distinct) > 0)
{
$this->ci->db->distinct($this->distinct);
$this->ci->db->select($this->columns);
}, add this line else this $this->ci->db->select($this->query);
I have a query that selects 4 columns from different tables, I also need to group them
but when whenever i try to group them I get an error on my page
This is the structure of my query
$this->datatables->select(first,second,third,MAX(CASE WHEN id = fid THEN 'T' ELSE 'F' end) as fourth');
->from(tableA);
$this->datatables ->join(......)
-->join(.....)
$this ->datatables->where(tableA.somevalue > 0);
$this->datatables->group_by(first,id,second,third);
I get this following message from my page ( I am using codeigniter for php)
Error Number: 42000
[Microsoft][SQL Server Native Client 10.0][SQL Server]Column 'tableA.BranchId' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
select * from tableA join ..... group by first,id,second,third
As you can notice the error is clearly doing a 'select * from tableA' I don't know why is it doing that
The text was updated successfully, but these errors were encountered: