473,542 Members | 2,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

1 New Member
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.
Dec 22 '20 #1
1 1729
32,562 Recognized Expert Moderator MVP
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
Dec 22 '20 #2

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

Similar topics

by: Rowan Chapman | last post by:
Hey all! I'm kinda new to VB but not to programin'. So I know what it is like when you are asked trivial questions. Could some1 please tell me what the syntax would be 2 only allow numerical data into a textbox. thankz in advanced -Ro -------------------------------------------------------------------- " Reality is an illusion caused by...
by: Ken VdB | last post by:
Hi everyone, Is there a reason why the Mid() function only works in one direction in VBScript? This code works in VB6 but not in VBScript? Is there a way around it? I am trying to create an ASP page which produces a fixed width text file for import into a third party legacy application which I don't have control over. --code sample--...
by: Yannick Warnier | last post by:
Hi there, I'd like to know since what version the md5() function is available in postgresql. I didn't find the function in the doc (I tried looking at some of the different function types in the user doc). Also, how may I find it by myself? Is there a complete list of function names and description somewhere? Thanks,
by: Raymond L. Buvel | last post by:
Due to the contribution of Frank Palazzolo, a Windows binary installer and build instructions are available for the clnum package. This also makes ratfun and rpncalc usable on the Windows platform. The clnum package adds rational numbers and arbitrary precision floating point numbers in real and complex form to Python. It also provides...
by: Greg | last post by:
Visual Studio - Line numbers missing from error list I'm writing an app in ASP.NET using VS 2005. There are no line numbers with the build errors reported. Any suggestions? I can't find any reports of anyone else having the same problem. Is there a setting I may have missed? Greg.
by: nishit.gupta | last post by:
Is their any single fuction available in C++ that can determine that a string contains a numeric value. The value cabn be in hex, int, float. i.e. "1256" , "123.566" , "0xffff" , It can also contain zero
by: Anz | last post by:
Can any one know the javascript function to auto resize the swf when resizing its pop up window. I need to auto resize the swf when i resize my popup window in which the swf is displayed. Is there any javascript function available to perform this requirement ?
by: Jock | last post by:
My purchase order system sequentially added the next number to the new order when I clicked the macro button set up with copy/paste functions and it worked well. I cannot do this now as 2007 does not offer these macro functions. My system simply looked at the last record copied the number in the field - opened a new record and pasted the...
by: kalees waran | last post by:
is it possible function available to use multiple headers in a page
by: mvjohn100 | last post by:
Does anyone know if there is a UUDecode function available to JavaScript john
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.