467,166 Members | 1,070 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,166 developers. It's quick & easy.

Max of Two Numbers in SQL - What function is available?

I am trying to figure out a way to find the max of two numbers in access, and then multiply whatever the max is by 0.008.
For example:
2019 Sales - $9,634.33
2020 Sales - $3,466.37
Find the max of the two and multiply by 0.008.

Hopefully I am explaining this well. The 2019 and 2020 sales differ for each company, so not everyone's 2020 sales will be greater than their 2019 and vice versa.
4 Weeks Ago #1
  • viewed: 1335
1 Reply
Expert Mod 16PB
Hi there.

Are you calculating this from within a query or from VBA?

Either way you can use the IIf() function but illustrating it changes based on your usage.

Query (SQL) :
Expand|Select|Wrap|Line Numbers
  1. IIf([2019 Sales]>[2020 Sales],[2019 Sales],[2020 Sales])*0.008
Expand|Select|Wrap|Line Numbers
  1. X = IIf(dbl2019Sales > dbl2020Sales, dbl2019Sales, dbl2020Sales)*0.008
4 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

9 posts views Thread by Rowan Chapman | last post: by
10 posts views Thread by Ken VdB | last post: by
1 post views Thread by Yannick Warnier | last post: by
reply views Thread by Raymond L. Buvel | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.