UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Query To Choose The Smallest Of The Three...    
 
   
williams9969
post Nov 22 2011, 08:51 AM
Post #1

UtterAccess Ruler
Posts: 1,888
From: US Army / Iraq



Hi all:

I am trying to build something into my query but need some help.

I need to display the smallest number of the three available parameters.

For instance

AST: = 20%
ASN: = 30%
ASQ: = 40%

Then the result (ASP) would be the below
ASP= 20%

I need to display them all in the same query.

Can anyone please assist?

Thanks in advance

Dan
Go to the top of the page
 
+
theDBguy
post Nov 22 2011, 08:54 AM
Post #2

Access Wiki and Forums Moderator
Posts: 48,611
From: SoCal, USA



Hi Dan,

What version of Access are you using? Knowing the Access version may help us determine a more appropriate response to your question.

Are those fields in your table or data values? Can you illustrate exactly what you want the query to look like?

Not sure if you could just use the Min() function or need a different one.

Just my 2 cents... (IMG:style_emoticons/default/2cents.gif)
Go to the top of the page
 
+
williams9969
post Nov 22 2011, 09:09 AM
Post #3

UtterAccess Ruler
Posts: 1,888
From: US Army / Iraq



Sorry about that...ACC 2007

The percentages I am trying to find the minimum of are based on calculations in the query.

I just need to display which one is the smallest while showing all three at the same time.

Thanks for your help!!!!

Dan
Go to the top of the page
 
+
theDBguy
post Nov 22 2011, 12:57 PM
Post #4

Access Wiki and Forums Moderator
Posts: 48,611
From: SoCal, USA



Hi Dan,

Can you post a sample query result? I think I can understand the question better when I can see how it looks like.

Thank you.

PS. Don't forget to use the <code> tags to preserve any spacing/formatting.

This post has been edited by theDBguy: Nov 22 2011, 12:59 PM
Go to the top of the page
 
+
John Spencer
post Nov 22 2011, 02:15 PM
Post #5

UtterAccess VIP
Posts: 2,473
From: Columbia, Maryland



The logic using the IIF operator is

IIF(A<=B and A<=C,A,IIF(B<=C,B,C))

If you are doing this with calculated fields in the query, then you have to replace A, B, and C with the calculations and not with the field alias assigned to the calculation.
Go to the top of the page
 
+
williams9969
post Nov 27 2011, 01:26 PM
Post #6

UtterAccess Ruler
Posts: 1,888
From: US Army / Iraq



Thank you both for taking the time to respond and assist me.

I got it working using John's response.

Again, thank you both and Happy Holiday's!

Respectfully

Dan
Go to the top of the page
 
+
theDBguy
post Nov 28 2011, 12:24 PM
Post #7

Access Wiki and Forums Moderator
Posts: 48,611
From: SoCal, USA



Hi Dan,

Glad to hear you found a solution that works for you.

(IMG:style_emoticons/default/yw.gif)

John and I are happy to help. Good luck with your project.
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 19th June 2013 - 10:32 AM