复制
收藏
提问
全网

SELECT IFNULL( c.compId, '1' ) compId, c.compShortName, IFNULL( c.compCompID, '' ) compCompID, IFNULL( c.compName, '未绑定单位' ) compName, COUNT( CASE WHEN checkType = '1' THEN 1 END ) AS jsCount, COUNT( CASE WHEN checkType = '0' THEN 1 END ) AS count, d.compName compCompName FROM checkinfo b LEFT JOIN companyinfo c ON b.checkCompanyId = c.compId LEFT JOIN companyinfo d ON c.compCompId = d.compId WHERE b.STATUS = '1' -- AND c.compName != '未绑定单位' GROUP BY c.compId, checkType ORDER BY count( checkId ) DESC 怎样优化

yangbaby
4个月前
全网
文档
学术
百科
知识库
时间不限
自动

理解问题SELECT IFNULL( c.compId, '1' ) compId, c.compShortName, IFNULL( c.compCompID, '' ) compCompID, IFNULL( c.compName, '未绑定单位' ) compName, COUNT( CASE WHEN checkType = '1' THEN 1 END ) AS jsCount, COUNT( CASE WHEN checkType = '0' THEN 1 END ) AS count, d.compName compCompName FROM checkinfo b LEFT JOIN companyinfo c ON b.checkCompanyId = c.compId LEFT JOIN companyinfo d ON c.compCompId = d.compId WHERE b.STATUS = '1' -- AND c.compName != '未绑定单位' GROUP BY c.compId, checkType ORDER BY count( checkId ) DESC 怎样优化

已完成理解SELECT IFNULL( c.compId, '1' ) compId, c.compShortName, IFNULL( c.compCompID, '' ) compCompID, IFNULL( c.compName, '未绑定单位' ) compName, COUNT( CASE WHEN checkType = '1' THEN 1 END ) AS jsCount, COUNT( CASE WHEN checkType = '0' THEN 1 END ) AS count, d.compName compCompName FROM checkinfo b LEFT JOIN companyinfo c ON b.checkCompanyId = c.compId LEFT JOIN companyinfo d ON c.compCompId = d.compId WHERE b.STATUS = '1' -- AND c.compName != '未绑定单位' GROUP BY c.compId, checkType ORDER BY count( checkId ) DESC 怎样优化

展开阅读网页

更专业一些
转笔记
专业
SELECT IFNULL( c.compId, '1' ) compId, c.compShortName, IFNULL( c.compCompID, '' ) compCompID, IFNULL( c.compName, '未绑定单位' ) compName, COUNT( CASE WHEN checkType = '1' THEN 1 END ) AS jsCount, COUNT( CASE WHEN checkType = '0' THEN 1 END ) AS count, d.compName compCompName FROM checkinfo b LEFT JOIN companyinfo c ON b.checkCompanyId = c.compId LEFT JOIN companyinfo d ON c.compCompId = d.compId WHERE b.STATUS = '1' -- AND c.compName != '未绑定单位' GROUP BY c.compId, checkType ORDER BY count( checkId ) DESC 怎样优化
不在提醒

更专业内容正在努力生成中
知识树
SELECT IFNULL( c.compId, '1' ) compId, c.compShortName, IFNULL( c.compCompID, '' ) compCompID, IFNULL( c.compName, '未绑定单位' ) compName, COUNT( CASE WHEN checkType = '1' THEN 1 END ) AS jsCount, COUNT( CASE WHEN checkType = '0' THEN 1 END ) AS count, d.compName compCompName FROM checkinfo b LEFT JOIN companyinfo c ON b.checkCompanyId = c.compId LEFT JOIN companyinfo d ON c.compCompId = d.compId WHERE b.STATUS = '1' -- AND c.compName != '未绑定单位' GROUP BY c.compId, checkType ORDER BY count( checkId ) DESC 怎样优化
如何优化SQL查询性能?
SQL查询优化技巧有哪些?
如何提高数据库查询效率?

以上内容由AI搜集生成,仅供参考

在线客服