• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Select distinct in active record

#1
[eluser]Unknown[/eluser]
Hi

Does anyone know if its possible to do a 'select distinct' using the active record class rather than doing it manually?

cheers

Neale

#2
[eluser]champs[/eluser]
The AR class is just a fancy string builder. For example:

Code:
<?php
$this->db->select('DISTINCT foo.bar, baz.field1, baz.field2');
$this->db->from('footable AS foo');
$this->db->join('baztable AS baz', 'foo.bar=baz.bip');
$this->db->where('baz.importantvalue', 123);
// and even....
$this->db->orderby('RAND()');
?>


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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