mysql - SQL: how to get a weighted count using GROUP BY? -


how can make query like:

select myvalue, count() freq mytable group myvalue; 

but freq sums values weight column instead of counting each row 1?

i'm using mysql 5.1.

select myvalue, sum(weight) freq mytable group myvalue; 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -