Welcome Guest, Not a member yet? Register   Sign In
DB Lib: active record: HOW TO "WHERE NOT EXISTS"
#1

[eluser]Jan_1[/eluser]
I want to get all lines of the table 'contacts', which are not yet in the table 'customers'.
Code:
SELECT contacts.id,
       contacts.etc
FROM contacts
WHERE NOT EXISTS ( SELECT 1
                   FROM customers
                   WHERE customers.id_source = contacts.id
                   AND customers.table_source = contacts.source
                   )

What is the way to use "where_not_exists()" in active record class, please?
like $this->db->where...


Have tryed without success:
Code:
$sql = "WHERE NOT EXISTS(...)";
$this->db->query($sql);


Messages In This Thread
DB Lib: active record: HOW TO "WHERE NOT EXISTS" - by El Forum - 02-22-2013, 05:06 AM
DB Lib: active record: HOW TO "WHERE NOT EXISTS" - by El Forum - 02-22-2013, 10:15 AM
DB Lib: active record: HOW TO "WHERE NOT EXISTS" - by El Forum - 02-22-2013, 04:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB