sum problem

  • Thread starter Thread starter jenaine
  • Start date Start date
J

jenaine

hello,

A table has list of 100 transactions.now i want to make
query using this formula:

result=(((sum from input 1 until input x)*75%)+(sum from
input (x+1) until end))/total quantity

x is input by user
how to create query for such calculation?

rgrds,
jenaine
 
Hi,


I assume x is not a record number but a value to be compared to, using a
field, ie, if

Fieldx <=x, use y=Input1 * 0.75
Fieldx > x, use y=Input1

and return the SUM(y)


that could be:

SELECT 0.75*SUM( iif(Fieldx<=x, input1, 0) )
+ SUM(iif(Fieldx >x, input1, 0 ) )

FROM ...



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top