SELECT
t1.name,
t2.course_id,
t2.count_class_session,
t2.sum_duration,
t4.id,
t4.rowNo
FROM
`tb_course` t1
LEFT JOIN ( SELECT course_id, count(*) count_class_session, sum( duration ) sum_duration FROM tb_class_session GROUP BY course_id ) t2 ON t2.course_id = t1.id
LEFT JOIN tb_learn_record t3 ON t3.course_id = t1.id
LEFT JOIN (
SELECT
a.id,
( @rowNum := @rowNum + 1 ) AS rowNo
FROM
tb_class_session a,
( SELECT ( @rowNum := 0 ) ) b
ORDER BY
a.sequence_no ASC
) t4 ON t4.id = t3.class_session_id
求助 如何 把 t1.id 传入 SELECT a.id, ( @rowNum := @rowNum + 1 ) AS rowNo FROM tb_class_session a, ( SELECT ( @rowNum := 0 ) ) b ORDER BY a.sequence_no ASC 内
1
WhereverYouGo 2021-03-17 16:42:26 +08:00
把👴看晕了
|
2
WhereverYouGo 2021-03-17 16:42:53 +08:00
格式化一下啊
|