Hello John, I did some more testing, got it working but still don't understand everything. > This should work: > > $vendors = > Vendor::Manager->get_vendors( > with_objects => [ 'products' ], > query => [ 'products.vendor_id' => undef ]);
Yes, this works fine. > That may not be the most efficient way to do this query, however. > Throwing a hard-coded SQL sub-query into the WHERE clause might be > faster: > > SELECT ... FROM vendors v WHERE NOT EXISTS > (SELECT * FROM products p WHERE p.vendor_id = id) > > You'd use the "clauses" param to do that: > > $subselect = > 'NOT EXISTS (SELECT * FROM products p WHERE p.vendor_id = id)'; > > $vendors = Vendor::Manager->get_vendors(clauses => [ $subselect ]); This doesn't work for me (result list is empty but should have two entries). If I change the $subselect to Cees' 'id NOT IN (SELECT vendor_id FROM products)' it works. Is this perhaps a limitation of SQLite? Cheers, Michael ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object