Wednesday, March 7, 2012

Different sums from table

Could someone explain to me, how I can get sum from row which I have values in 2 colums and I want the realtime sum to third column. Fourth colum is for item.

Also can someone tell me how to sum these third colums where the item is same so I have real time values for the item sum.

Thanks!

AD

Hi,

regardless that this makes no sense at all, this could be an example (as far as I understood your problem):

Select OrderId, Sum(Unitprice) + Sum (Quantity) AS ThirdColumn

from [Order Details]

Group by OrderId

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

No comments:

Post a Comment