"Pavel Ivanov" <paiva...@gmail.com> schrieb im
Newsbeitrag
news:f3d9d2130910170753k6e680ecdtcb892f05b21cc...@mail.gmail.com...

> > select * from foo f1 where
> > (select count(*) from (select distinct b from foo f2 where f1.a = f2.a
and f2.b in (...) )) =
> >    length_of_b_list
> > and b in (...);

> Shouldn't this be simplified like this?
>
> select * from foo f1 where
> (select count(distinct b) from foo f2 where f1.a = f2.a and f2.b in
(...) ) =
>    length_of_b_list
> and b in (...);

Just to add another one to the pile, any flaws I overlooked here...?

select *, count(b) c_b from foo
where b in (...)
group by a
having c_b = length_of_b_list

Olaf



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to