1、错误描述
1 queries executed, 0 success, 1 errors, 0 warnings
查询:SELECT stu_id, (SELECT stu_name FROM t_student_info t WHERE t.stu_id = t.stu_id) stu_name FROM (SELECT SUM( CASE course WHEN '敮..
错误代码: 1248
Every derived table must have its own alias
执行耗时 : 0 sec
传送时间 : 0 sec
总耗时 : 0 sec
2、错误原因
SELECT
stu_id,
(SELECT
stu_name
FROM
t_student_info t
WHERE t.stu_id = t.stu_id) stu_name
FROM
(SELECT
SUM(
CASE
course
WHEN '数学'
THEN Score
ELSE 0
END
) 数学,
SUM(
CASE
course
WHEN '语文'
THEN score
ELSE 0
END
) 语文,
SUM(
CASE
course
WHEN '英语'
THEN score
ELSE 0
END
) 英语,
stu_id
FROM
t_score_info
GROUP BY stu_id)
3、解决办法
SELECT
*
FROM
(
SELECT
stu_no
FROM
t_student_info
UNION
SELECT
stu_no
FROM
t_student_info
) student;
在后面给联合查询取个别名student