mysql一些使用心得
2022/4/3 19:19:45
本文主要是介绍mysql一些使用心得,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
- 单个包含可以使用 LOCATE(要查找的字符串,字段)
- 多个可以使用 字段 REGEXP '字符串1|字符串2|....'
- 替换函数 REPLACE(字段,原字符串,新字符串)
- group_concat会被截取
SET SESSION group_concat_max_len=5120;
SET GLOBAL group_concat_max_len=5120;
group_concat_max_len = 5120
SELECT temp. product, complaint_Content AS complaintContent, itemType, yy, COUNT( DATE_SUB( acceptance_Time, INTERVAL -8 HOUR) = '2021-6-16' OR NULL) AS dayCount, COUNT( YEARWEEK( DATE_SUB( acceptance_Time, INTERVAL -8 HOUR), 1) = YEARWEEK( '2021-6-16', 1) OR NULL) AS weekCount, gy, IF( COUNT( tl. id) > 0, '1', '0' ) as press FROM ( SELECT product, acceptance_Time, complaint_Content, itemType, IFNULL( GROUP_CONCAT( yy. yy ORDER BY yy. yy DESC SEPARATOR '' ), '' ) AS yy, IFNULL( GROUP_CONCAT( gy. gy ORDER BY gy. gy DESC SEPARATOR '' ), '' ) AS gy FROM tb_c_complaint c LEFT JOIN ( SELECT swift_number, CONCAT_WS( ' ', create_Date, add_comment, u. chinese_name) AS gy FROM tb_c_fun_reason tr LEFT JOIN tb_m_user u ON u. user_Id = tr. user_Id ) gy ON gy. swift_number = c. swift_Number LEFT JOIN ( SELECT swift_number, CONCAT_WS( ' ', create_Date, add_comment, u. chinese_name) AS yy FROM tb_c_reason tr LEFT JOIN tb_m_user u ON u. user_Id = tr. user_Id ) yy ON c. swift_number = yy. swift_number WHERE product IN ( SELECT group_name FROM tb_b_fn_group_mem WHERE group_type = 'yw' AND depart_id = 0 ) AND acceptance_Time BETWEEN DATE_SUB( SUBDATE( '2021-6-16', IF( DATE_FORMAT( '2021-6-16', '%w' )= 0, 7, DATE_FORMAT( '2021-6-16', '%w' ) )-1), INTERVAL 8 HOUR) AND DATE_SUB( SUBDATE( '2021-6-16', IF( DATE_FORMAT( '2021-6-16', '%w' )= 0, 7, DATE_FORMAT( '2021-6-16', '%w' ) )-7), INTERVAL -16 HOUR) GROUP BY c. swift_Number ORDER BY acceptance_Time DESC ) temp LEFT JOIN tb_b_press_log tl on tl. item_type = temp. itemType AND tl. press_time> DATE_ADD( CURDATE( ), INTERVAL - DAY( CURDATE( ) )+ 1 DAY) AND (ac_msg!= '' OR st_msg!= '' OR cbc_msg!= '' ) WHERE 1= 1 GROUP BY temp. itemType;
这篇关于mysql一些使用心得的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-02MySQL 3主集群搭建
- 2024-12-25如何部署MySQL集群资料:新手入门教程
- 2024-12-24MySQL集群部署资料:新手入门教程
- 2024-12-24MySQL集群资料详解:新手入门教程
- 2024-12-24MySQL集群部署入门教程
- 2024-12-24部署MySQL集群学习:新手入门教程
- 2024-12-24部署MySQL集群入门:一步一步搭建指南
- 2024-12-07MySQL读写分离入门:轻松掌握数据库读写分离技术
- 2024-12-07MySQL读写分离入门教程
- 2024-12-07MySQL分库分表入门详解