Re: [sqlite] Re: Calculating the mode

2005-11-21 Thread Kurt Welgehausen
> select salary, count(*) occurs from payroll > group by salary having occurs = > (select count(*) c from payroll group by salary >order by c desc limit) OR select salary, count(*) from payroll group by salary having count(*) = (select max(cnt) from (select count(*) cnt

[sqlite] Re: Calculating the mode

2005-11-21 Thread Igor Tandetnik
[EMAIL PROTECTED] wrote: "Igor Tandetnik" <[EMAIL PROTECTED]> wrote: Tim Martin wrote: Does anyone have any working solutions for calculating the mode of a set of values in SQLite? I'm not exactly sure what "mode" is. From your examples, it seems you want to get an element that occurs most

[sqlite] Re: Calculating the mode

2005-11-21 Thread Igor Tandetnik
Tim Martin wrote: Does anyone have any working solutions for calculating the mode of a set of values in SQLite? I'm not exactly sure what "mode" is. From your examples, it seems you want to get an element that occurs most often. This should do it: select salary, count(*) occurs from