RE: average in Group By

2004-06-04 Thread Kevin Cowley
From: Shantanu Oak [mailto:[EMAIL PROTECTED] Sent: 04 June 2004 17:26 To: [EMAIL PROTECTED] Subject: average in Group By Hi, I am trying to find average price of the shares in the portfolio table. I thought something like this should work... SELECT symbol, ((sum(buyrate*quantity))/quantity) as ave

Re: average in Group By

2004-06-04 Thread Jim Winstead
On Fri, Jun 04, 2004 at 09:25:58AM -0700, Shantanu Oak wrote: > I am trying to find average price of the shares in the > portfolio table. > I thought something like this should work... > SELECT symbol, ((sum(buyrate*quantity))/quantity) as > average > from portfolio group by symbol; > > It does w

average in Group By

2004-06-04 Thread Shantanu Oak
Hi, I am trying to find average price of the shares in the portfolio table. I thought something like this should work... SELECT symbol, ((sum(buyrate*quantity))/quantity) as average from portfolio group by symbol; It does work, but wrong results. What is the correct query? Shantanu Oak