[sqlite] Get Max Samples

2009-11-10 Thread Rick Ratchford
Suppose you had a column called SampleNumber. And in this column, you might have... 1 1 1 2 2 2 2 3 3 4 4 4 5 5 5 5 etc. How would you write the SQL statement that would return the maximum number of a sample? For example, if within the SampleNumber column, the SampleNumber 17 had more

Re: [sqlite] Get Max Samples

2009-11-10 Thread Pavel Ivanov
You're right about max() and group_concat() will not help you either. You need something like this: select max(cnt) from (select count(*) as cnt from table_name group by SampleNum) Pavel On Tue, Nov 10, 2009 at 3:24 PM, Rick Ratchford r...@amazingaccuracy.com wrote: Suppose you had a column

Re: [sqlite] Get Max Samples

2009-11-10 Thread Matt Sergeant
On Tue, 10 Nov 2009 15:28:30 -0500, Pavel Ivanov wrote: You're right about max() and group_concat() will not help you either. You need something like this: select max(cnt) from (select count(*) as cnt from table_name group by SampleNum) That'll give you the count of the largest set. But not

Re: [sqlite] Get Max Samples

2009-11-10 Thread Igor Tandetnik
Rick Ratchford r...@amazingaccuracy.com wrote: How would you write the SQL statement that would return the maximum number of a sample? For example, if within the SampleNumber column, the SampleNumber 17 had more records (say there are 23 SampleNumber = 17 in the table, more than any

Re: [sqlite] Get Max Samples

2009-11-10 Thread Rick Ratchford
. :-) Rick #-Original Message- #From: sqlite-users-boun...@sqlite.org #[mailto:sqlite-users-boun...@sqlite.org] On Behalf Of Igor Tandetnik #Sent: Tuesday, November 10, 2009 2:33 PM #To: sqlite-users@sqlite.org #Subject: Re: [sqlite] Get Max Samples # #Rick Ratchford r...@amazingaccuracy.com