Welcome Guest, Not a member yet? Register   Sign In
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()');
?>




Theme © iAndrew 2016 - Forum software by © MyBB