[eluser]Unknown[/eluser]
Hello folks,
Using the active record syntax, I am trying to find duplicate records based on two fields. The query works, but it returns all records from the table (instead of only the duplicates. I cannot figure out what I am doing wrong. Any help would be greatly appreciated.
Code:
$this->db->from('shipments a');
$this->db->join('shipments b', 'a.cust_name=b.cust_name AND a.address1=b.address1', 'inner');
$this->db->where('a.id !=', 'b.id');
$this->db->order_by('a.cust_name');
return $this->db->get()->result();
Additionally, I have tried:
Code:
$this->db->where('a.id <>', 'b.id');
in the where clause.
Thanks!