只显示 mysql 查询的最高结果? [英] Display only top result from mysql query?

查看:43
本文介绍了只显示 mysql 查询的最高结果?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何仅显示此查询的最高/最大百分比?

How can I display only the top/largest percentage from this query?

select round((count(*)*100)/(select count(*) from test),1) as percent from test group by field1 order by percent desc

例如这是从查询中收到的数据:

For example this is data received from the query:

我希望在此查询的 HTML 页面上显示的是:

What I want displayed on an HTML page from this query is this:

推荐答案

MySQL 限制!

select round((count(*)*100)/(select count(*) from test),1) as percent from test group by field1 order by percent desc LIMIT 1;

这篇关于只显示 mysql 查询的最高结果?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆