Re: [sqlite] Selecting with distinct on across two columns

2018-06-09 Thread Joseph L. Casale
-Original Message- From: sqlite-users On Behalf Of R Smith Sent: Saturday, June 9, 2018 6:04 PM To: sqlite-users@mailinglists.sqlite.org Subject: Re: [sqlite] Selecting with distinct on across two columns > DISTINCT is nothing more than a GROUP BY for the entire SELECT list. Brilli

Re: [sqlite] Selecting with distinct on across two columns

2018-06-09 Thread R Smith
On 2018/06/10 1:41 AM, Joseph L. Casale wrote: 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

Re: [sqlite] Selecting with distinct on across two columns

2018-06-09 Thread Abroży Nieprzełoży
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 : > I have a

[sqlite] Selecting with distinct on across two columns

2018-06-09 Thread Joseph L. Casale
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