在MySQL DataBase中转到COLUMN。

时间:2014-03-20 11:48:39

标签: mysql sql database mysql-workbench

考虑下表的示例:

2tables and a transistion table with a desired output at the right side

请帮助我掌握所有知识,谢谢 我正在考虑现在只使用数据库(MySQL)仪式。因此,如果显示输出,则不使用任何PHP或java语言。

1 个答案:

答案 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;

sqlfiddle to click