0

Hi

I want to write a query which will return me Sum(MarkU) and also the avg.

Which is something like (Sum(Sum(MarkU)))/5 in mathematically operation

or

TotMark = Sum(MarkU)

AvgMark = TotMark / 5

I hope you get an idea what i need.

How to write this type of query in Db ?

I am using that query for Crystal report.
I tried to get this by using Formula field. But that formula field returning me the result of all rows not for a single row.

Please guide...


Thanks in advance. :)

2
Contributors
2
Replies
3
Views
9 Years
Discussion Span
Last Post by sbv
0

select sum(column1)\5, column2, column3, column4,.... from table1 where some conditions

but

I am using that query for Crystal report.
I tried to get this by using Formula field. But that formula field returning me the result of all rows not for a single row.

because you put it in a row so, for each row Crystal report repeats it.. try to define it by some way to avoid that...

0

hi RamyMahrous,
Thanks for reply.
As you said in your first query the sum(column1)/5.
Its right. But my requirement is diff. I want sum of a column from database and then depending upon a criteria i need average.

As i mentioned in my earlier post that i tried by using Formula filed in crystal report. And the problem i faced is solved by sending a second column with the sum column.
as i need sum of markU column, so i put a formula as SUM({Query_SS.MarkU},{Query_SS.Dealer})
so i get the sum as per dealer.

Thanks. Have a nice time. :)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.