Hi,
I have a union all query in a stored procedure.
WHat I would like to do is Sum a column and return that query to the client
How would I do this?
Malcolm
From stackoverflow
-
SELECT SUM(MyCol) FROM ( SELECT ... MyCol FROM Table1 UNION SELECT ... MyCol FROM Table2 ) -
SELECT othercol1, othercol2, SUM(bar) FROM ( SELECT othercol1, othercol2, bar FROM RT UNION ALL SELECT othercol1, othercol2, bar FROM FM ) foo GROUP BY othercol1, othercol2
0 comments:
Post a Comment