Hai All,
I have a problem in creating AVG for a Column.
Cos i have a Column ,that is formulated from Division of two other columns Summation
(i.e) SUM(COL1)/SUM(COL2) = COL3
I need to create AVG for COL3
It's not possible to use like this : AVG( SUM(COL1)/SUM(COL2) )
So i used Function to get the Output.
Is there any other way to formulate this work.
Please Enlighten me.
Thanx,
Karthik.A
SELECT AVG(x) AS theAverage
FROM
(
SELECT
SomeCol,
SUM(ColA) / SUM(ColB) AS x
FROM Tbl
GROUP BY SomeCol
) y (SomeCol, x)
|||Hai Adam,
I am already have the data values come from a Stored Procedure.
What i need is,for COL3=AVG(Sum(COL1)/Sum(COL2))
Already some table columns of theStored Procedure are assign to the COL1 and COL2.
Do u need any more explanation.
Thanx,
Karthik.A|||Yes; can you post DDL, some sample data, and the code you're trying to use right now?
See: Etiquette [ASP FAQ]
No comments:
Post a Comment