当前位置:网站首页>How to optimize this SQL?
How to optimize this SQL?
2022-07-22 15:14:00 【CSDN Q & A】
SELECT
s.id AS schoolId,
#{param.billNumber} as bill_number,
sum( CASE WHEN t.category = 1 THEN 1 ELSE 0 END ) AS a
sum( CASE WHEN t.category = 2 THEN 1 ELSE 0 END ) AS b,
sum( CASE WHEN t.category = 3 THEN 1 ELSE 0 END ) AS c,
s.short_name AS schoolName,
s.city
FROM
school s
LEFT JOIN classhour_student t ON t.school_id = s.id
AND t.delete_flag = 0
AND t.created_time >= "2022-06-01 00:00:00"
AND t.created_time <= "2022-06-30 23:59:59"
WHERE
s.type = 1
What can be optimized ?
边栏推荐
- 2022-07-18 exists子查询的剔除遍历处理
- 322. Change exchange ●●
- 乐观锁、悲观锁、分布式锁的总结
- How to make the signal of conductive slip ring better
- 2022-07-13 mysql/stonedb的快速子查询和慢子查询执行对比
- Leetcode 202. happy number (2022.07.21)
- Elastase Worthington core enzyme detailed reference
- 滑环的分类以及用途
- Introduction to relevant matters of PMP preparation guide
- Redis的拓展方案
猜你喜欢
2022-07-13 comparison of fast subquery and slow subquery execution of mysql/stonedb
【社媒营销】进来了解下Whatsapp Business API?出海群发不用愁!
Worthington 细胞分离优化系统(含细胞分离指南)
Various application schemes of animal free collagenase Worthington
Primary data structure - advantages and disadvantages of sequential list and linked list (leading bidirectional cyclic linked list) + knowledge of CPU cache.
How to prolong the working life of slip ring
Pytorch Deep Learning Practice - 1 - Overview
visual studio踩坑记录
Redis的拓展方案
Redis----三大特殊数据类型、事务、整合、配置文件、持久化rdb和aof、发布订阅、主从复制(哨兵模式)、缓存穿透和雪崩
随机推荐
2022-07-13 mysql的查询优化分析
ADS多频功放偏置网络设计
如何围绕用户数字化运营?
109. Ordered linked list transformation binary search tree ●●
2022-07-19 mysql/stonedb sub query hashjoin logic processing
Huitong programming level 5 - Magic School Lesson 7
Elastase Worthington core enzyme detailed reference
Paper reading | point voxel CNN for efficient 3D deep learning
10 baseline papers required for entry recommendation system
one billion two hundred and thirty-four million five hundred and fifty-six thousand six hundred and sixty-six
Recall to order: multi-objective sorting distillation recall
硅谷课堂笔记(中)
等保合规2022系列 | 今年,关于等保你该了解什么?
1.openpyxl 打开工作簿
2022-07-18 jenkins部署
发布时间测试
Escape methods of special characters in URL links
2022-07-13 mysql/stonedb subquery optimizer processing record
2022-07-18 eliminate traversal processing of exists subquery
2022-07-12 使用perf统计mysql执行的性能