Solved

max(field1,field2) from a table

Posted on 2004-10-08
4
271 Views
Last Modified: 2010-08-05
Hi,

   I need to retrieve the maximum value of three fields from an Access table from a row. How do I write my query in my ASP  page. I tried retriving valu like

select max(price1,price2,prie3) from table1

which throws error as invalid argument passed. Please help me

Rags
0
Comment
Question by:rgvn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12257117
I think you would do it like this:

SELECT Max(price1) AS Max1, Max(price2) AS Max2 , Max(price3) AS Max3 FROM table1
0
 
LVL 77

Expert Comment

by:peter57r
ID: 12257160
Hello rgvn,

Idon't know whether you can use iif in ASP but in a standard Jet query you would be able to do:

select iif(price1>=price2 and price1>=price3, price1, iif(price2>=price1 and price2>=price3, price2,price3)) from....


Pete
0
 
LVL 15

Accepted Solution

by:
will_scarlet7 earned 50 total points
ID: 12257213
Sorry, I though you were trying to get the max of each field. If you want the max between the three then Pete's solution is the right way to go.

Sam
0
 
LVL 15

Expert Comment

by:will_scarlet7
ID: 12257373
Shouldn't the answer have been credited to Pete?
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question