例如:学生交学费,分年交,表是根据年限建立的。每个表都是学号SNO,姓名SNAME,缴费sal,这个学费不是所有学生都一样的,现在想要看看2年来所有学生各交了多少费用。
恩 忘了个条件 就是只要查询学号在n和s之间的学生 学号是在另一个表c中,c表是学校分成各系的学生名册
这样写 select sno,sname,(a.sal+b.sal) as sal from a,b where a.sno=b.sno and a.no in(select sno from c where sno between 'n' and 's') and b.no in(select sno from c where sno between 'n' and 's') group by sno,sname,sal 提示列无效
select sno,sname,(a.sal+b.sal) as sal from a,b where a.sno=b.sno and a.no in(select sno from c where sno between 'n' and 's') and b.no in(select sno from c where sno between 'n' and 's') group by sno,sname,sal 提示列无效