select id, first_name, family_name, eq_id,
date_of_birth, gender, indigenous, eal_d,
atsi, icp, disability_category,
(select raw_score
from path_maths_term0 as T0
where T0.eq_id=S.eq_id and year=2011
) as raw_score_2011term1,
(select raw_score
from path_maths_term0 as T0
where T0.eq_id=S.eq_id and year=2011
) as raw_score_2011term1,
(select scale_score
from path_maths_term0 as T0
where T0.eq_id=S.eq_id and year=2011
) as scale_score_2011term1,
(select percentile
from path_maths_term0 as T0
where T0.eq_id=S.eq_id and year=2011
) as percentile_2011term1,
(select stanine
from path_maths_term0 as T0
where T0.eq_id=S.eq_id and year=2011
) as stanine_2011term1,
class
from student_details as S
where S.school_id ="SCH00001" and S.class = " 5B"
答案 0 :(得分:0)
试试这个
select id, first_name, family_name, eq_id, date_of_birth, gender, indigenous, eal_d, atsi, icp, disability_category,
(select raw_score from path_maths_term0 as T0 where T0.eq_id=S.eq_id and T0.year=2011 ) as raw_score_2011term1,
(select scale_score from path_maths_term0 as T0 where T0.eq_id=S.eq_id and T0.year=2011 ) as scale_score_2011term1,
(select percentile from path_maths_term0 as T0 where T0.eq_id=S.eq_id and T0.year=2011 ) as percentile_2011term1,
(select stanine from path_maths_term0 as T0 where T0.eq_id=S.eq_id and T0.year=2011 ) as stanine_2011term1,
class from student_details as S
where S.school_id ="SCH00001" and S.class = " 5B"
答案 1 :(得分:0)
在您的子查询中使用LIMIT 1
,例如
select raw_score from path_maths_term0 as T0 where T0.eq_id=S.eq_id and year=2011 LIMIT 1