We’d like to remind Forumites to please avoid political debate on the Forum.

This is to keep it a safe and useful space for MoneySaving discussions. Threads that are – or become – political in nature may be removed in line with the Forum’s rules. Thank you for your understanding.

📨 Have you signed up to the Forum's new Email Digest yet? Get a selection of trending threads sent straight to your inbox daily, weekly or monthly!
The Forum now has a brand new text editor, adding a bunch of handy features to use when creating posts. Read more in our how-to guide

Micrsoft Access how to select highest value?

Hi, is there any easy way in access to look at 3 columns of data, pick the highest value and insert it into another column?

Many thanks

Comments

  • isofa
    isofa Posts: 6,091 Forumite
    Use a query, first to join the 3 columns of data into one, the the Max function to pick out the highest value. As you want to insert it into another column rather than a row, the best way would be to setup one select query, then one update query based on that for clarity.

    This would be simpler in Excel.
  • Money_Saver
    Money_Saver Posts: 364 Forumite
    Part of the Furniture 100 Posts Combo Breaker
    Regards,

    Money Saver

  • astreix
    astreix Posts: 238 Forumite
    Part of the Furniture 100 Posts Name Dropper Combo Breaker
    Do you want to pick the max of three values in each row? If you want to do that add a blank column (for output). Use an update query and update that column as max(col1, col2, col3)
  • jamalfatty
    jamalfatty Posts: 960 Forumite
    You could use the Switch function within your SELECT statement ->

    Switch (columnA > columnB and columnA > columnC, columnA, columnB > columnA and columnB>columnC, columnB, columnC > columnA and columnC > columnB, columnC)

    Not most elegant of solutions but works without depending on other queries and ensures always accurate as is recalculated each time query is run.

    As your selecting the MAX of multiple fields though, this suggests that they are all similar or even identical datatypes, might be more beneficial redesigning the tables to enable you to use the built in aggregate functions for this purpose
This discussion has been closed.
Meet your Ambassadors

🚀 Getting Started

Hi new member!

Our Getting Started Guide will help you get the most out of the Forum

Categories

  • All Categories
  • 353.5K Banking & Borrowing
  • 254.2K Reduce Debt & Boost Income
  • 455.1K Spending & Discounts
  • 246.6K Work, Benefits & Business
  • 603K Mortgages, Homes & Bills
  • 178.1K Life & Family
  • 260.6K Travel & Transport
  • 1.5M Hobbies & Leisure
  • 16K Discuss & Feedback
  • 37.7K Read-Only Boards

Is this how you want to be seen?

We see you are using a default avatar. It takes only a few seconds to pick a picture.