Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

round and sum

Status
Not open for further replies.

zzzzzeke

Programmer
Mar 1, 2004
14
US
can you round a sum

SELECT payment_method, SUM (subtotal)
FROM orders
group by payment_method
order by payment_method
 
Sure you can,

SELECT payment_method, Round(SUM (subtotal),0)
FROM orders
group by payment_method
order by payment_method


SELECT payment_method, Round(SUM (subtotal),-1)
FROM orders
group by payment_method
order by payment_method


SELECT payment_method, Round(SUM (subtotal),1)
FROM orders
group by payment_method
order by payment_method
 
It' s not quite as simple. The MS Access round function doesn't handle the rounding of 0.5 consistently and you have to use (int(value *100 +0.5)/100) to round to two decimal places. check Helen feddema's site for more detail if you dson't understand this brief explanation.

Access makes all things possible. It even makes them intelligible
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top