• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[solved] Get $this->db->distinct() to work

#4
[eluser]soamazing[/eluser]
Thnx Xwero! That's all I needed.

Removing the parameter of distinct didn't work, also it should only make sure it doesn't get duplicates of items with the same name, while there can be duplicates in 'image' and 'category_id'.

The other option to use group_by('name') is the solution to my problem. It works perfectly! Have seen this function in the 'user guide' but didn't knew I could use it for this particular problem.

For the onces stumbling upon this topic while searching for a solution for the distinct function, my working end code now looks like;

Code:
$this->db->select('id,name,image,category_id,pnumber');
        $this->db->group_by('name');
    $this->db->where('country_id',$countryid);
    $this->db->orderby('name','asc');
    $Q = $this->db->get('products');

Again thanks for this simple solution xwero!


Messages In This Thread
[solved] Get $this->db->distinct() to work - by El Forum - 10-14-2008, 03:56 AM
[solved] Get $this->db->distinct() to work - by El Forum - 10-14-2008, 07:20 AM
[solved] Get $this->db->distinct() to work - by El Forum - 10-14-2008, 07:27 AM
[solved] Get $this->db->distinct() to work - by El Forum - 10-14-2008, 07:40 AM
[solved] Get $this->db->distinct() to work - by El Forum - 10-14-2008, 07:48 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


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