jeudi 6 mars 2014

add two results of two alias


Vote count:

0




this is my query:


in a query have many results that come from summations, these summations want to get the percentage among them, so I want to assign a variable, this solution a try since I can not add up the alias, I would like to add 2 AS a, 1 AS b of the form a + b AS result ... Same query header


Select a.*, SUM( a.val1 ) AS val1, SUM( b.val2 ) AS val2 from quest1 a , quest2 b


I want to do this:


Select a., @N:= SUM( a.val1 ) AS val1, @M:= SUM( b.val2 ) AS val2, (100@N/@M) as percent from quest1 a , quest b



asked 1 min ago






Aucun commentaire:

Enregistrer un commentaire