SQLite allows you to simply do:
    select colA, colB, colC from tab group by colA, colB;
You can also do:
    select colA, colB, min(colC) from tab group by colA, colB;
or:
    select colA, colB, max(colC) from tab group by colA, colB;

2018-06-10 1:41 GMT+02:00, Joseph L. Casale <jcas...@activenetwerx.com>:
> I have a table where I need to select all distinct records from two columns
> and
> include a third that varies. It is possible that for multiple records where
> the first
> and second columns are equivalent, the third varies so it cannot be used in
> the
> distinct clause. In this case, I want to select the third column in the
> first record
> and ignore the remaining to append to the final result.
>
> For example:
>
> colA | colB | colC
> -----------------------
> aaa | bbb | lorem ipsum
> aaa | bbb | lorem ipsum dolar
> aaa | ccc | foo bar
>
> This should only return the first and third row.
>
> How do you do this in SQLite?
>
> Thanks,
> jlc
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to