当前位置:网站首页>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 .
边栏推荐
- Global and Chinese market for blood typing 2022-2028: Research Report on technology, participants, trends, market size and share
- QT small case "addition calculator"
- C language uses arrays to realize the intersection, union, difference and complement of sets
- Acwing-宠物小精灵之收服-(多维01背包+正序倒序+两种形式dp求答案)
- RF ride side door processing of prompt box
- Close of office 365 reading
- Basic knowledge of public security -- FB
- Temperature sensor DS18B20 principle, with STM32 routine code
- P3D gauge size problem
- 借助 Navicat for MySQL 软件 把 不同或者相同数据库链接中的某数据库表数据 复制到 另一个数据库表中
猜你喜欢

From then on, I understand convolutional neural network (CNN)

Deepin get file (folder) list

大学生活的自我总结-大一

The number of occurrences of numbers in the offer 56 array (XOR)

Acwing-宠物小精灵之收服-(多维01背包+正序倒序+两种形式dp求答案)

Idea common settings

Miracast技术详解(一):Wi-Fi Display

The mutual realization of C L stack and queue in I

I implement queue with C I

Thunderbird tutorial \ easy to use mail client
随机推荐
Use stm32cubemx tool to write the demo program of FreeRTOS
QT small case "addition calculator"
SQL JOINS
Good websites need to be read carefully
Deepin, help ('command ') output saved to file
Numpy——1.數組的創建
Application of ultra pure water particle counter in electronic semiconductors
Basic knowledge of public security -- FB
Function of static
Global and Chinese market of blackbody calibration source 2022-2028: Research Report on technology, participants, trends, market size and share
数字孪生实际应用案例-风机篇
Batch modify the txt file code to UTF-8 (notepad++)
Let me teach you how to develop a graphic editor
大学生活的自我总结-大一
P3D gauge size problem
Practical application cases of digital Twins - fans
How to deal with excessive memory occupation of idea and Google browser
Calibre garbled
Oracle-触发器和程序包
C language uses arrays to realize the intersection, union, difference and complement of sets