Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top