On 11/12/08, baxy77bax <[EMAIL PROTECTED]> wrote:
>
>  hi,
>  my question is: Is there a way to count the number of specific data in the
>  column of a table, for example:
>
>  let say i have a table like this:
>  numbers
>  1
>  2
>  2
>  3
>  4
>  4
>  4
>  ...
>  and i would like to report my data in form:
>  numbers | count
>  1 | 1
>  2 | 2
>  3 | 1
>  4 | 3
>  ...


SQLite version 3.5.9
Enter ".help" for instructions
sqlite> create table foo (a);
sqlite> insert into foo values (1);
sqlite> insert into foo values (2);
sqlite> insert into foo values (2);
sqlite> insert into foo values (3);
sqlite> insert into foo values (4);
sqlite> insert into foo values (4);
sqlite> insert into foo values (4);
sqlite> select * from foo;
1
2
2
3
4
4
4
sqlite> select a, count(a) from foo;
4|7
sqlite> select a, count(a) from foo group by a;
1|1
2|2
3|1
4|3
sqlite>


>
>  so far i have been doing this by using sql count function and looping it
>  through perl , but now i'm looking for a faster way to do this, so if
>  anybody has an idea ...
>  thank you!
>
> --
>  View this message in context: 
> http://www.nabble.com/count-duplicates-in-the-table-coloumn-tp20467510p20467510.html
>  Sent from the SQLite mailing list archive at Nabble.com.
>
>  _______________________________________________
>  sqlite-users mailing list
>  sqlite-users@sqlite.org
>  http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
>


-- 
Puneet Kishor http://punkish.eidesis.org/
Nelson Institute for Environmental Studies http://www.nelson.wisc.edu/
Open Source Geospatial Foundation (OSGeo) http://www.osgeo.org/
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to