BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Sql Aggregate Expression to find % difference betwen two col

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers)
View previous topic :: View next topic  
Author Message
afm
Guest





PostPosted: Mon Jul 12, 2004 8:47 pm    Post subject: Sql Aggregate Expression to find % difference betwen two col Reply with quote



I have a table including columns for Quantities_Bought and Quantities_Sold.
I am trying to find an sql expression which will give me the ratio of the
Sum(Quantity_Sold) / Sum(Quantity_Bought). I have tried:

SELECT Sum(Answer2.Qty_Bought) AS SumOfQty_Bought, Sum(Answer2.Qty_Sold) AS
SumOfQty_Sold, Sum([Qty_sold]/[Qty_Bought]) AS [Percentage Sold]
FROM Answer2;

On a test table the results came out:

Bought Sold Sold/Bought

110 55 5.5 ( ?)


I need to use the expression in an Orpheus Reportview component.

Many thanks for any help.


Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (SQL Servers) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.