Displaying 1 result from an estimated 1 matches for "feat_id".
Did you mean:
ext_id
2006 Aug 22
0
Re: Problem with find condition and habtm relationship.
...riendly''). The SQL you want should go
something like
select r.rest from rests r where not exists (select * from feats f
where f.feat in (''cheap'', ''kid-friendly'') and not exists (select *
from rests2feats r2f where r.id = r2f.rest_id and f.id = r2f.feat_id))
The key is in the two nested selects. They are looking for a counter-
example: a feat in (''cheap'', ''kid-friendly'') that your restaurant
doesn''t have -- ie, where there is no row in the habtm table linking
your restaurant and that feature. The fir...