本文介绍了一个SQL查询中的最大计数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在oracle数据库中有下表(简体):
I have the following table (simplified) in an oracle db:
productId | modelDescription 1 | thing 2 | another thing 3 | not a thing 4 | thing我想选择此表中出现频率最高的模型描述.问题在于可能存在几乎无限的模型描述. 因此结果集应如下所示:
I want to select the modeldescription which has the highest appearence in this table. The problem is that there can be nearly infinite model descriptions. So the resultset should look like something like this:
modelDescription | appearance thing | 2 another thing | 1 ... | ...推荐答案
select modeldescription, count(modeldescription) from products group by modeldescription order by 2 desc
更多推荐
一个SQL查询中的最大计数
发布评论