[thelist] SQL question
rudy
r937 at interlog.com
Thu Aug 22 18:02:00 CDT 2002
> That unfortunately translates to conditions where s.www_id is
> either 2 OR 4. Note the "OR"... it should be "AND".
lauri, what you want requires grouping
not sure why you were saying comp_id=1
the following works for any comp_id, and returns only those that have both
www_id=2 and www_id-4
select first.comp_id
from first
inner join second
on first.comp_id = second.comp_id
and www_id in (2,4)
group by first.comp_id
having count(*)=2
whaddya know, works in mysql too ;o)
rudy
More information about the thelist
mailing list