Nigel Verity wrote:
Hi
I'd be grateful for a little advice on SQL syntax, as supported by sqlite.
I have a table containing, typically, around 50,000 records. Within the table one 
particular field will contain many occurrences of the same string value. I can produce a 
de-duplicated list of the values from that field using "SELECT DISTINCT", but 
it would be useful to have an occurrence count against each value so that, for example, 
the list
aaaaaabbbccccccccc
would produce the output
aaa, 2bbb, 1ccc, 3
I know there are ways of achieving this by joining multiple views but, for my 
own education, I'd like to know if there is an elegant way of achieving this in 
a single query.
Thanks
Nige

You say something like this:

  select myfield, count(*) as mycnt from mytbl group by myfield

... where myfield is the one containing the duplicates.

-- Darren Duncan
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to