Frage

Consider an example of the following table:

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

Please help me with all your knowledge, Thank you I am considering of using only the database(MySQL) rite now. So if the output is shown, not using any PHP or java languages.

War es hilfreich?

Lösung

I'm try to get exact solution as following as:

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;

the sqlfiddle to click

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top