考虑下表的示例:
请帮助我掌握所有知识,谢谢 我正在考虑现在只使用数据库(MySQL)仪式。因此,如果显示输出,则不使用任何PHP或java语言。
答案 0 :(得分:2)
我尝试按以下方式获得精确解决方案:
SELECT two.stname,
SUM(smark*(1-ABS(SIGN(sname)))) AS en,
SUM(smark*(1-ABS(SIGN(sname)))) AS mat,
SUM(smark*(1-ABS(SIGN(sname)))) AS phy
FROM a1 AS ONE
LEFT JOIN a2 AS two
ON one.sid=two.stid
GROUP BY sname;