Thank you Pavel, that works great.

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.


The rows returned by the SELECT can be uniquely identified so I'm guessing
this will involve linking TableA to itself and checking the necessary
columns for different values.  Does that sound a reasonable way to approach
this?

Pete
lcSQL Software <http://www.lcsql.com>



On Sat, Jun 23, 2012 at 9:00 AM, <[email protected]> wrote:

> Message: 5
> Date: Fri, 22 Jun 2012 19:17:39 -0400
> From: Pavel Ivanov <[email protected]>
> To: General Discussion of SQLite Database <[email protected]>
> Subject: Re: [sqlite] Selecting from a GROUP Select
> Message-ID:
>        <cag1a4rtd4itkhmp6srmn81lof35ckndb464rh1wjuax-8si...@mail.gmail.com
> >
> Content-Type: text/plain; charset=ISO-8859-1
>
> I guess you need something like
>
> SELECT * from TableA
> WHERE z in (
> SELECT z FROM TableA GROUP BY z HAVING count(*)=2
> );
>
>
> Pavel
>
>
> On Fri, Jun 22, 2012 at 6:43 PM, Peter Haworth <[email protected]> wrote:
> > I have a situation where I need to select entries based on the count of
> the
> > number of entries in a GROUP = 2, and also that the value of a specific
> > column must be different for each row in the group. I then need to select
> > all the individual rows from the qualifying groups.
>
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to