On Tue, Jun 26, 2012 at 3:02 PM, Igor Tandetnik <itandet...@mvps.org> wrote:
> On 6/26/2012 1:19 PM, Peter Haworth wrote:
>>
>> I still have the issue that, in order to be selected,  the rows in the
>> groups containing two entries must have a different value in a specific
>> column.
>
>
> I'm not quite sure I understand the condition, but perhaps you are looking
> for something like this:
>
>
> SELECT * from TableA WHERE z in (
>  SELECT z FROM TableA GROUP BY z
>  HAVING count(*)=2 and min(otherColumn) != max(otherColumn)
> );

Maybe this can be simplified?


SELECT * from TableA WHERE z in (
 SELECT z FROM TableA GROUP BY z
 HAVING count(distinct otherColumn)=2
);


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

Reply via email to