select * from student as a left join music as b on a.stuID = b.stuID left join sport as c on a.stuID = c.stuID left join dance as d on a.stuID = d.stuID where stuName = @StuName
select * from music where music.id=特定学生id union select * from sport where music.id=特定学生id union select * from dance where music.id=特定学生id
select name, decode((select count(*) from music where stuid=student.name),0,'没参加','参加') music , decode((select count(*) from sport where stuid=student.name),0,'没参加','参加') sport, decode((select count(*) from dance where stuid=student.name),0,'没参加','参加') dance from student
from student as a
left join music as b on a.stuID = b.stuID
left join sport as c on a.stuID = c.stuID
left join dance as d on a.stuID = d.stuID
where stuName = @StuName
select * from music where music.id=特定学生id
union
select * from sport where music.id=特定学生id
union
select * from dance where music.id=特定学生id
decode((select count(*) from music where stuid=student.name),0,'没参加','参加') music ,
decode((select count(*) from sport where stuid=student.name),0,'没参加','参加') sport,
decode((select count(*) from dance where stuid=student.name),0,'没参加','参加') dance
from student