计数字段中唯一值的实例 [英] Counting Instances of Unique Value in Field
本文介绍了计数字段中唯一值的实例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
假设您在SQL中有一个表格:
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 times.
52.00 - 3 times.
或者:
3 (i.e. 13.99, 14.00, 52.00)
干杯。
推荐答案
如何:
SELECT Prices, COUNT(*) FROM TheTable GROUP BY Prices
在MySql上试过,但我期望它工作...
Can't say I've tried it on MySql, but I'd expect it to work...
这篇关于计数字段中唯一值的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文