行中的MYSQL日期值为动态列

时间:2018-02-15 03:47:36

标签: mysql

我似乎无法解决这个问题。我是MYSQL的新手并且正在尝试一些东西。 省时间帮忙??

SELECT stu.stud_id Student_ID, stu.lastname Student_Name, sec.sect_id, a.attend_status Attendance_Status, date(a.datetime) Attendance_Date 
FROM student stu 
INNER JOIN attendance a ON (stu.stud_id=a.stud_id) 
INNER JOIN section sec ON (a.sect_id=sec.sect_id) 
GROUP BY a.datetime  

output of the query above

预期产出:

   +----+-----------+-----------+-----------+-----------+ 
   | id |    name   | 2018-02-07| 2018-02-08| new date  |
   |    |           |           |           | if added  |
   +----+-----------+-----------+-----------+-----------+ 
   |  1 |    Alupig |   present |      null |    ----   |
   |  3 |     Perez |   present |      null |    ----   | 
   |  2 |    Verana |      null |   present |    ----   | 
   +----+-----------+-----------+-----------+-----------+  

0 个答案:

没有答案