select a.user_name,b.skill,c.skill
from user1 a
join user1_skills b on a.id = b.user_id and b.skill="念经"
join user1_skills c on b.user_id = c.user_id and c.skill="变化"
join user1_skills d on d.user_id = c.user_id and d.skill="腾云"
where b.skill_level > 0 and c.skill_level>0 and d.skill_level>0
from user1 a
join user1_skills b on a.id = b.user_id and b.skill="念经"
join user1_skills c on b.user_id = c.user_id and c.skill="变化"
join user1_skills d on d.user_id = c.user_id and d.skill="腾云"
where b.skill_level > 0 and c.skill_level>0 and d.skill_level>0
2016-04-03
那些求数据库脚本的,如果把老师所讲的都弄明白了,我觉得自己都能完场数据库脚本的建立,不就是几张表然后搞清楚表与表之间的关系,
2016-02-16
讲师回答 / sqlercn
最简单的方法,就是把这个查询做为一个子查询,在外面加select nname,count(*) from ( sql ) a group by nname
2015-12-31