当前位置: 数据库>sqlserver
sql分组查询(按组内个数排序)
来源: 互联网 发布时间:2014-08-29
本文导语: 例子,sql分组查询实例。 代码示例: select family,count(*)as familyNum from bold group by family order by familyNum desc 输出结果: Emberizidae 739 Anatidae 735 Tyrannidae 635 Parulidae 507 Scolopacidae 399 Muscicapidae 349 Fringillidae 346 Turdidae ...
例子,sql分组查询实例。
代码示例:
select family,count(*)as familyNum from bold group by family order by familyNum desc
输出结果:
Emberizidae 739
Anatidae 735
Tyrannidae 635
Parulidae 507
Scolopacidae 399
Muscicapidae 349
Fringillidae 346
Turdidae 317
Picidae 299
Sylviidae 289
Corvidae 248
Furnariidae 227
Paridae 203
Accipitridae 196
Strigidae 194
Icteridae 190
Columbidae 178
Sturnidae 164
Spheniscidae 162
...
Anatidae 735
Tyrannidae 635
Parulidae 507
Scolopacidae 399
Muscicapidae 349
Fringillidae 346
Turdidae 317
Picidae 299
Sylviidae 289
Corvidae 248
Furnariidae 227
Paridae 203
Accipitridae 196
Strigidae 194
Icteridae 190
Columbidae 178
Sturnidae 164
Spheniscidae 162
...