答案 0 :(得分:2)
您应该按照以下方式编写查询:
SELECT student, class, 'Monday' AS weekday
FROM table_1
WHERE has_on_monday='T'
UNION ALL
SELECT student, class, 'Tuesday' AS weekday
FROM table_1
WHERE has_on_tuesday='T'
UNION ALL
....
如果要将结果插入table_2,请使用INSERT查询:
INSERT INTO table_2 (student, class, weekday)
SELECT ...the select query above...