优化 MySQL 查询对 GROUP BY 3 Tables Count 中的结果进行排序
我有以下疑问:
SELECT contry, count(contry) as 'N'
FROM user_ip_tmp
GROUP BY contry
ORDER BY count(contry) DESC
LIMIT 40
SELECT iconOperation, count(iconOperation) as 'N'
FROM user_ip_tmp
GROUP BY iconOperation
ORDER BY count(iconOperation) DESC
LIMIT 40
SELECT iconBrowser, count(iconBrowser) as 'N'
FROM user_ip_tmp
GROUP BY iconBrowser
ORDER BY count(iconBrowser) DESC
LIMIT 40
并且工作正常 但疯狂的原因 Query take Large 每个查询
Showing rows 0 - 29 ( 40 total, Query took 2.2857 sec)
意味着所有查询的总数查询花费了15.661秒
我想合并查询中的所有狂欢一个查询
最终结果如下
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

如果您的意思是所有 6 列一起显示为一个记录集,其中一行包含国家/地区及其计数,然后是浏览器及其计数,然后是操作系统及其计数,我目前不认为这是可能的。除了没有太大帮助的表名称之外,可以链接在一起的集合之间似乎没有任何关系。如果可以的话,请建立这些查询之间的关系:)
If you mean for all 6 columns to appear together as one recordset where one row has the country and its count followed by the browser and its count followed by the os and its count, I don't see how that's possible at the moment. There doesn't seem to be any relationship between the sets that can be linked together apart from the table name which isn't much help. If you can, please establish the relationship among these queries :)