MySQL 5.5 Community Server
MySQL 5.6 Community Server
Percona Configuration Wizard
XtraBackup 搭建主从复制
Great Sites on MySQL
Percona
MySQL Performance Blog
Severalnines
推荐管理工具
Sequel Pro
phpMyAdmin
推荐书目
MySQL Cookbook
MySQL 相关项目
MariaDB
Drizzle
参考文档
http://mysql-python.sourceforge.net/MySQLdb.html
rqxiao
V2EX  ›  MySQL

sql 问题的求助

  •  
  •   rqxiao · Mar 17, 2021 · 2205 views
    This topic created in 1889 days ago, the information mentioned may be changed or developed.

    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 内

    2 replies    2021-03-17 16:42:53 +08:00
    Masonnn
        1
    Masonnn  
       Mar 17, 2021
    把👴看晕了
    Masonnn
        2
    Masonnn  
       Mar 17, 2021
    格式化一下啊
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5317 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 08:15 · PVG 16:15 · LAX 01:15 · JFK 04:15
    ♥ Do have faith in what you're doing.