当前位置:网站首页>SQL used query statements
SQL used query statements
2022-04-23 09:11:00 【Sloppy procedure】
sql Multiple tables associated query , Carry out daily data statistics
## complex
SELECT
b.ds,
substring_index(
substring_index(a.key_words, '|', b.cotitle + 1),
'|',
-1
) course
FROM
search_task a
JOIN daily b on b.cotitle < (
length(a.key_words) - length(REPLACE(a.key_words, '|', '')) + 1
)
sql Query daily task volume ( There is only one data in the table , Perform multi table associated query , Date data of target table )
SELECT
b.ds,(
SELECT
COUNT(0)
FROM
tousu.heimao_search_task
) as count_i
FROM
mao_search a
JOIN video_daily b
GROUP by
ds
sql The average
select ds,concat(
TRUNCATE(
(
(SELECT count(1) FROM wx_account_stat where company_id > 0)/
(SELECT count(1) FROM wx_account_stat where unit_nature=' Enterprises ')
)
* 100,2),'%'
) as rate from wx_account_stat group by ds;
sql Format date
select DATE_FORMAT(update_time,'%Y-%m-%d') AS created from wx_accountc
sql Field add
replace into video_collection_stat.video_daily (ds , cnt ,platform_name)
sql Calculate the daily increment ( Cumulative data )
SELECT a.ds AS date_t,SUM(b.num) AS cum FROM
(SELECT sum(cnt) as num ,ds FROM video_daily GROUP BY ds) a
JOIN
(SELECT sum(cnt) as num ,ds FROM video_daily GROUP BY ds) b
ON a.ds >= b.ds GROUP BY a.ds
sql Remove null values for calculation
select cotitle, sum(cnt) as sum_int from video_daily
where cotitle!='' GROUP BY cotitle
sql Use when the window is black ( Columns show )
Inquire about :select * from t_copr_tort limit 1 \G;
sql (LEFT JOIN Fill up )
SELECT
a.ds,
COUNT(1)
FROM
(SELECT ds FROM yuqing_daily GROUP BY ds) a
LEFT JOIN
(SELECT DATE_FORMAT(beg_time, '%Y-%m-%d') AS ds FROM t_search_task) b
ON a.ds >= b.ds
GROUP BY a.ds
sql Subtraction before and after (join)
SELECT a.day , a.account_number - b.account_number as ram_sum FROM
(SELECT DATE_FORMAT(DATE_SUB(day,INTERVAL 1 DAY),'%Y-%m-%d') as day,account_number from wx_public) AS a
JOIN
(SELECT day,account_number from wx_public) AS b
ON a.day = b.day
版权声明
本文为[Sloppy procedure]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230656278448.html
边栏推荐
- Applet error: cannot read property'currenttarget'of undefined
- Node installation
- Applet error: should have URL attribute when using navigateto, redirectto or switchtab
- ALV树(LL LR RL RR)插入删除
- Pctp test experience sharing
- How to protect open source projects from supply chain attacks - Security Design (1)
- 小程序报错 :should have url attribute when using navigateTo, redirectTo or switchTab
- [in-depth good article] detailed explanation of Flink SQL streaming batch integration technology (I)
- Four pictures to understand some basic usage of Matplotlib
- Introduction to GUI programming swing
猜你喜欢

The K neighbors of each sample are obtained by packet switching

Redis Desktop Manager for Mac

Enterprise wechat application authorization / silent login

Please arrange star trek in advance to break through the new playing method of chain tour, and the market heat continues to rise

Idea package jar file

653. 两数之和 IV - 输入 BST

Harbor enterprise image management system

Strength comparison vulnerability of PHP based on hash algorithm

Detailed explanation of delete, truncate and drop principles in MySQL database

npm报错 :operation not permitted, mkdir ‘C: \Program Files \node js \node_ cache _ cacache’
随机推荐
A must see wechat applet development guide 1 - basic knowledge
Employee probation application (Luzhou Laojiao)
[C language] document operation
On array replication
653. 两数之和 IV - 输入 BST
Use include in databinding
Research purpose, construction goal, construction significance, technological innovation, technological effect
Failed to download esp32 program, prompting timeout
How to read excel table to database
PLC point table (register address and point table definition) cracking detection scheme -- convenient for industrial Internet data acquisition
Summary of common concepts and problems of linear algebra in postgraduate entrance examination
112. 路径总和
Kettle实验 (三)
数字政府建设中政务中台中的技术创新点
AQS & reentrantlock implementation principle
Wechat: get the owner of a single tag
MYCAT configuration
Mini - exercice MySQL (seulement pour les débutants, pas pour les non - débutants)
Colorui solves the problem of blocking content in bottom navigation
Trc20 fund collection solution based on thinkphp5 version