• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 264
  • Last Modified:

MS Access Math in Query

I want to subtract, add, multiply, and divide different records in my Access query....How do I do this?  For example:

Select Dog, Cat, Beaver
From Animals

I want to divide Dog into Cat, and subtract Beaver from Dog.


I would like to apologize for my example and appreciate your help with this nonetheless.

cheers.

pr
0
Patrick Ryan
Asked:
Patrick Ryan
1 Solution
 
Arthur_WoodCommented:
Select Cat/Dog, Dog-Beaver from YourTable

or in the QueryBuilder:

in Column1 in the field row:  Expr1: Cat/Dog

in Column2, in the Field Row Expr2: Dog-Beaver

that will generate this SQL:

Select Cat/Dog as Expr1, Dog-Beaver as Expr2 from YourTable

the two are EXACTLY equivalent.

This of course assumes that Dog, Cat and Beaver are fields the hold NUMBERS in YourTable.

AW
0
 
stevbeCommented:
No comment has been added lately, so it's time to clean up this TA.
I will leave the following recommendation for this question in the Cleanup topic area:

Accept: Arthur_Wood {http:#9733717}

Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

stevbe
EE Cleanup Volunteer
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now