Pavel Ivanov wrote:
>> 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 (...);

I wasn't sure SQLite supported count(distinct). The docs don't seem to mention 
it. But yes, apparently it does and the statement can be simplified this way.

Igor Tandetnik

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

Reply via email to