#1247 - 参考' sid'不支持(参考组功能)

时间:2015-09-04 11:20:57

标签: mysql

(参考群体功能) -

SELECT `subject`,
GROUP_CONCAT(`student_id` SEPARATOR ',') as sid,
(SELECT concat(fname,' ',surname )
FROM student_registration 
WHERE student_id IN (sid) ) as name
FROM `email` GROUP BY `subject` 

1 个答案:

答案 0 :(得分:0)

尝试一下,如果你想要别的东西还原它 -

SELECT a.`subject`, GROUP_CONCAT(a.student_id SEPARATOR ',') AS sid, CONCAT( b.fname,' ',b.surname ) AS 'name' 
FROM email AS a 
LEFT JOIN student_registration AS b ON b.student_id=a.student_id 
GROUP BY a.`subject`;