历史最长的SQL语句
Posted Tinywan
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了历史最长的SQL语句相关的知识,希望对你有一定的参考价值。
注释:查询该课程表下,所有的课程以及课程观看的人数统计
SELECT ml.`name` as lessonName,ml.category,ml.deleted,ml.teacherName, ml.id,ml.liveId,ml.selected,mlc.channelId,p.viewNums,count(*) as totalNum from mlk_live_channel AS ml LEFT JOIN mlk_lesson_channel AS mlc ON mlc.lessonId = ml.id LEFT JOIN mlk_live_channel AS mcl ON mcl.id = mlc.channelId LEFT JOIN (SELECT mpr.liveId,mpr.memberId,COUNT(mpr.liveId) as viewNums FROM mlk_payment_record AS mpr WHERE mpr.payType = 3 AND mpr.notify = 1 GROUP BY mpr.liveId) AS p ON p.liveId = mcl.liveId WHERE ml.deleted = 0 AND ml.category = 1 GROUP BY ml.id ORDER BY ml.create_time
以上是关于历史最长的SQL语句的主要内容,如果未能解决你的问题,请参考以下文章
SQL 语句超过 PHP 中的最长时间,但在 phpMyAdmin 中立即运行