Re: [sqlite] Get Max Samples

2009-11-10 Thread Rick Ratchford
quot;] GROUP BY Year in the statement. This seems to do the trick. Thanks ya'll. :-) 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: sqlit

Re: [sqlite] Get Max Samples

2009-11-10 Thread Igor Tandetnik
Rick Ratchford 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

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.

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 wrote: > > Suppose you had a

[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