• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 298
  • Last Modified:

max(field1,field2) from a table

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
rgvn
Asked:
rgvn
  • 3
1 Solution
 
will_scarlet7Commented:
I think you would do it like this:

SELECT Max(price1) AS Max1, Max(price2) AS Max2 , Max(price3) AS Max3 FROM table1
0
 
peter57rCommented:
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
 
will_scarlet7Commented:
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
 
will_scarlet7Commented:
Shouldn't the answer have been credited to Pete?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now