Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access thread: MAX Problem


Message #1 by "Dave Loukola" <dave.loukola@H...> on Fri, 25 Oct 2002 15:02:52
I have a few columuns in a table:

col1  col2   col3   col4
1     3      7      2
2     5      1      4
3     1      9      4

What I want to do is get the maximum of the number in the row easily.
I have considered using IIF statements, but in the real world there is 
more than 4 columns which can make IIF statements a real hassle. I 
therefore want the table to look like this:

col1  col2   col3   col4  col5
1     3      7      2     (I want this to return 7)     
2     5      1      4     (I want this to return 5)
3     1      9      4     (I want this to return 9)

This seems like such an easy problem, I just can't seem to find the 
appropriate solutions.

Thanks in advance for any help that you have.


Dave
Message #2 by Lonnie Johnson <prodevmg@y...> on Fri, 25 Oct 2002 07:36:36 -0700 (PDT)
Here is a thread from another group that has several solutions.
http://www.tek-tips.com/viewthread.cfm?SQID=298809&SPID=181&newpid=181&page=1&CFID=7401015&CFTOKEN=80233671
 Dave Loukola <dave.loukola@H...> wrote:I have a few columuns in a table:

col1 col2 col3 col4
1 3 7 2
2 5 1 4
3 1 9 4

What I want to do is get the maximum of the number in the row easily.
I have considered using IIF statements, but in the real world there is 
more than 4 columns which can make IIF statements a real hassle. I 
therefore want the table to look like this:

col1 col2 col3 col4 col5
1 3 7 2 (I want this to return 7) 
2 5 1 4 (I want this to return 5)
3 1 9 4 (I want this to return 9)

This seems like such an easy problem, I just can't seem to find the 
appropriate solutions.

Thanks in advance for any help that you have.


Dave

Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Let me build your next MS Access database application. 





---------------------------------
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
Message #3 by "Carnley, Dave" <dcarnley@a...> on Fri, 25 Oct 2002 09:38:30 -0500
largest value = MAX (col1, col2, col3, col4, col5, col6, col7...)

use the MAX function

-----Original Message-----
From: Dave Loukola [mailto:dave.loukola@H...]
Sent: Friday, October 25, 2002 10:03 AM
To: Access
Subject: [access] MAX Problem


I have a few columuns in a table:

col1  col2   col3   col4
1     3      7      2
2     5      1      4
3     1      9      4

What I want to do is get the maximum of the number in the row easily.
I have considered using IIF statements, but in the real world there is 
more than 4 columns which can make IIF statements a real hassle. I 
therefore want the table to look like this:

col1  col2   col3   col4  col5
1     3      7      2     (I want this to return 7)     
2     5      1      4     (I want this to return 5)
3     1      9      4     (I want this to return 9)

This seems like such an easy problem, I just can't seem to find the 
appropriate solutions.

Thanks in advance for any help that you have.


Dave

  Return to Index