当前位置:网站首页>Count and sort the occurrence times of specific fields through SQL statements
Count and sort the occurrence times of specific fields through SQL statements
2022-07-05 07:45:00 【qq_ twenty-nine million five hundred and sixty-six thousand six】
select log_ip, count(*) as number from tp_admin_log group by log_ip order by number desc
The function realized is statistics tp_admin_log table log_ip The number of times each value of the field appears and is sorted in descending order .
ps:
It should be noted that ,group by Functions are generally related to aggregate functions , such as count() Functions together
Common aggregate functions are :COUNT(),SUM(),AVG(),MIN(),MAX().
COUNT(), Its main function is to return the number of rows in each group , Will also return yes NULL Columns of values , Can be used for numeric and character columns .
SUM(), It is mainly used to return the sum of all expressions , Ignore NULL value , For numeric columns only .
AVG(), Returns the average of all expressions , Only for numeric columns and automatically ignored NULL value .
MIN(), Returns the minimum value in the expression , Ignore NULL value , Can be used for digital 、 Character and date time Columns .
MAX(), Returns the maximum value in the expression , Ignore NULL value , Can be used for digital 、 Character and date time Columns .
边栏推荐
- Use of orbbec Astra depth camera of OBI Zhongguang in ROS melody
- [idea] common shortcut keys
- How to deal with excessive memory occupation of idea and Google browser
- Significance and requirements of semiconductor particle control
- The global and Chinese market of lithographic labels 2022-2028: Research Report on technology, participants, trends, market size and share
- QT's excellent articles
- String alignment method, self use, synthesis, newrlcjust
- Graduation thesis project local deployment practice
- Explain STM32 startup file in detail
- Query the table name used by kettle in Oracle
猜你喜欢

With the help of Navicat for MySQL software, the data of a database table in different or the same database link is copied to another database table

611. Number of effective triangles

Altium Designer 19.1.18 - 清除测量距离产生的信息

Unforgettable summary of 2021

Significance and requirements of semiconductor particle control

II Simple NSIS installation package

Ue5 hot update - remote server automatic download and version detection (simplehotupdate)

Deepin get file (folder) list

Self summary of college life - freshman

Latex notes
随机推荐
Selenium element positioning
How to delete the virus of inserting USB flash disk copy of shortcut to
Let me teach you how to develop a graphic editor
Oracle triggers and packages
I 用c I 实现队列
Realization of binary relation of discrete mathematics with C language and its properties
Embedded AI intelligent technology liquid particle counter
Web page Chinese display (print, etc.) GBK error, solution, software
Daily Practice:Codeforces Round #794 (Div. 2)(A~D)
Close of office 365 reading
Charles- unable to grab bags and surf the Internet
mysql 盲注常见函数
CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)
QT small case "addition calculator"
Global and Chinese market of resistivity meter 2022-2028: Research Report on technology, participants, trends, market size and share
UE5热更新-远端服务器自动下载和版本检测(SimpleHotUpdate)
Day01 markdown log entry tips
[neo4j] common operations of neo4j cypher and py2neo
NSIS search folder
Altium Designer 19.1.18 - 更改铺铜的透明度