开发者

Counting Instances of Unique Value in Field

Suppose you have a table in SQL:

Prices
------
13.99
14.00
52.00 
52.00 
52.00 
13.99

How would you count the amount of times a DIFFERENT field has been entered in? Therefore an example of such a count would output:

13.99 - 2 times. 
14.00 - 1开发者_StackOverflow社区 times. 
52.00 - 3 times.

OR perhaps:

3 (i.e. 13.99, 14.00, 52.00)

Can anyone advise? Cheers.


How about:

SELECT Prices, COUNT(*) FROM TheTable GROUP BY Prices

Can't say I've tried it on MySql, but I'd expect it to work...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜