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?
brinky_2
Posts: 184 Forumite
in Techie Stuff
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
Many thanks
0
Comments
-
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.0 -
Regards,
Money Saver0 -
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)0
-
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 purpose0
This discussion has been closed.
Confirm your email address to Create Threads and Reply
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