title: Having an issue using datatable library with codeigniter
body: <p>I already posted a question regarding this issue on another post but I want to try to be more specific here</p>
  
  <p>So I have the following query here using codeigniter with a library from <a href="https://github.com/IgnitedDatatables/Ignited-Datatables/wiki/Function-Reference" rel="nofollow">https://github.com/IgnitedDatatables/Ignited-Datatables/wiki/Function-Reference</a></p>
  
  <pre><code>&lt;?php
  
  public function GetQuery(){
  
   $this-&gt;datatables-&gt;select('tablessc.Name As region,p.name As name,tabled.test As test,
                                    MAX(CASE WHEN p.id= p.cid and flavor = 2  THEN \'Pass\' ELSE \'Fail\' end) as \'Pass\'
                                    ')
                            -&gt;from('drinks p');
                            $this-&gt;datatables-&gt;join('tableb ', 'tableb.id=p.pid','inner');
                            $this-&gt;datatables-&gt;join('tablec','tablec.TerritoryId=tablec.TerritoryId','inner');
                            $this-&gt;datatables-&gt;join('tabled','tablec.AccountId=tablec.AccountId','inner');
                            $this-&gt;datatables-&gt;join('tables','d.AccountId = tabless.AccountId ','inner');
                            $this-&gt;datatables-&gt;join('tablessc','tablesc.Code = p.region and sc.CodeGroup =\'Region\'','inner');
  
                            $this-&gt;datatables-&gt;where('region &gt;','0');
                            $this-&gt;datatables-&gt;where('p.location','0');
  
                            $this-&gt;datatables-&gt;group_by('tablessc.Name');
                            $this-&gt;datatables-&gt;group_by('p.id');
                            $this-&gt;datatables-&gt;group_by('p.name');
                            $this-&gt;datatables-&gt;group_by('atabled.test');
  
  echo $this-&gt;datatables-&gt;generate();
  }
  ?&gt;
  </code></pre>
  
  <p>Ok so if I run this query on microsoft sql I get no error and I get the results I want, but if i call this function from a page it will give me an error </p>
  
  <pre><code>Error Number: 42000
  
  [Microsoft][SQL Server Native Client 10.0][SQL Server]Column 'drinks.region' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause
  SELECT * FROM drinks p INNER JOIN.....
  </code></pre>
  
  <p>Just to take a note here why is the error showing the sql doing a select * 
  I tried taking the max aggregate function out and it still doing the same error.
  THe only way to get rid of this error is to take out the aggregate function MAX and the group by clause. Which is no the query I want.Any one else have experience this problem with the library? Thank you</p>