"Igor Tandetnik" <itandet...@mvps.org> schrieb im Newsbeitrag news:hbfjnu$v...@ger.gmane.org... > Olaf Schmidt wrote: > > 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 > > The OP apparently wanted actual (a, b) pairs for those a's > that satisfy the condition, not just a list of a's.
Oops, I had only the OPs: "I want the values of 'a' for which 'b' = 3 AND 'b' = 4" in mind - and forgot about the additional "b-column-listing" (which nonetheless should be somehow "redundant", since all the possible values of b were already explicitely specified as the filter-condition). maybe that small enhancement does it, to deliver the given condition back to the caller, contained within the resultset: select a, group_concat(b) from foo where b in (3, 4) group by a having count(b) = 2 as said, returning the b-values would be redundant in this special case - maybe more interesting for "app-usage" would be this slightly changed variant: select a, group_concat(RowID) from foo where b in (3, 4) group by a having count(b) = 2 Olaf _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users