Add filter IN subselect #4

Open
tenorviol opened this Issue Dec 11, 2009 · 0 comments

Projects

None yet

1 participant

@tenorviol
Owner

It should be possible to filter based on a subselect from another grubby query. Here is an example looking for rows in the table that have a category_id not in the category table.

$table->not(array('category_id'=>null))
      ->not(array('category_id'=>$category_table))
      ->read();

Mapping to SQL:

SELECT * FROM table
WHERE NOT(category_id IS NULL)
AND NOT(category_id IN (SELECT category_id FROM categories))

EXCEPTION: The subselect table may be in a separate database. Question, should we account for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment