That did the job - Thank You

On 18 February 2013 18:15, James K. Lowden <jklow...@schemamania.org> wrote:

> On Mon, 18 Feb 2013 17:02:53 +0000
> Paul Sanderson <sandersonforens...@gmail.com> wrote:
>
> > n    c
> > 1    a
> > 2    a
> > 3    a
> > 4    b
> > 5    b
> > 3    b
> > 4    b
> > 2    b
> > 3    a
> > 5    b
> > 2    b
> >
> >
> > I have a table as above
> >
> > I want to create a summary table that shows in the first column the
> > total number of occurrences of a value in the first column (n) and in
> > the second column for each value in n a count of the unique entries
> > in c
>
> Is this what you have in mind?
>
> sqlite> select n, count(*) as occurence, count(distinct c) as uniq
> from t group by n;
> n           occurence   uniq
> ----------  ----------  ----------
> 1           1           1
> 2           3           2
> 3           3           2
> 4           2           1
> 5           2           1
>
> --jkl
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to