Max of multiple columns (1 Viewer)

Status
Not open for further replies.

Gasman

Enthusiastic Amateur
Local time
Today, 00:19
Joined
Sep 21, 2011
Messages
14,310
Thanks Gasman. Again another comment unexplained.
I am not sticking my head in the sand I am learning.
I can play the saxophone and knit an arran sweater with ease but I am new to database code.
If you are going to make comments explain what you mean or don't bother commenting!!!!

OK, if I tried to play the saxophone horizontally and I asked you what was the best way to use my fingers on the keys, the first thing you would probably tell me is it is meant to be played vertically.?
I am doing it that way as I am an excellent flute player and have played the flute for years, hence my using just another wind instrument in the only way I know how. (I can't play any instrument really, but this is analogy world) :D

Pretty much the same analogy with a database.
Each of the fields that are n, n+1, n+2 should be in their own record, with whatever other info is required.
Then you just use the Access Max() function to get what you want.

You are thinking in Excel which a lot of people do to start with.
I would be doing the same if I tried to play the saxophone as I played the flute. :D


How is that. :)
 
Last edited:

Galaxiom

Super Moderator
Staff member
Local time
Today, 09:19
Joined
Jan 20, 2009
Messages
12,852
Thanks for the advice. I am new to this and though I appreciate your comment it did zero to help

A perfect match then to the zero acknowledgement you gave to the advice that your structure is wrong.

The_Doc_Man noted that we both had repeatedly advised that the request indicated structural errors through the thread. All you needed to do was read those posts and you would have had your explanation.

But no. You completely ignored the advice of two professional developers with more than ten thousand posts each and only acknowledged the person with three posts who naively gave you what you naively wanted.
 

Tezza444

New member
Local time
Yesterday, 16:19
Joined
Dec 13, 2019
Messages
7
A perfect match then to the zero acknowledgement you gave to the advice that your structure is wrong.

The_Doc_Man noted that we both had repeatedly advised that the request indicated structural errors through the thread. All you needed to do was read those posts and you would have had your explanation.

But no. You completely ignored the advice of two professional developers with more than ten thousand posts each and only acknowledged the person with three posts who naively gave you what you naively wanted.

How can I naively ignore NO help. You are just telling that I have done it wrong. Well done, yours years of experience have told me what I already know!!! That is why I am here asking your advice. Explain what you mean, not just keep repeating that my structure is wrong. How? What is wrong. How do I fix it? Maybe you should go and learn a brand-new subject and if you ask an expert for help and get this reply you will know just how useless your answers are to a novice...…..
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 09:19
Joined
Jan 20, 2009
Messages
12,852
How can I naively ignore NO help. You are just telling that I have done it wrong. Well done, yours years of experience have told me what I already know!!! That is why I am here asking your advice. Explain what you mean, not just keep repeating that my structure is wrong. How? What is wrong. How do I fix it?

I said in a post just three above your first on this thread:
These values should be stored in a related table with one record for each value. Another field stores a value to indicate which field the data would have been stored in using the current structure

You ignored The_Doc_Man's response when he reiterated the previous advice about the structure being the issue. All you needed to do was engage with us and we would have responded.

Maybe you should go and learn a brand-new subject and if you ask an expert for help and get this reply you will know just how useless your answers are to a novice...…..

We all were new at this once. I originally came here asking for help too. I followed up on the advice, especially when it suggested I was not doing something the best way and researched further until I thoroughly understood.

What you have been advised about your structure is right at the very foundations of database design. Unfortunately like many before, you preferred the quick and dirty fix over learning vital knowledge.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 00:19
Joined
Jul 9, 2003
Messages
16,282
How can I naively ignore NO help. You are just telling that I have done it wrong. Well done, yours years of experience have told me what I already know!!! That is why I am here asking your advice. Explain what you mean, not just keep repeating that my structure is wrong. How? What is wrong. How do I fix it? Maybe you should go and learn a brand-new subject and if you ask an expert for help and get this reply you will know just how useless your answers are to a novice...…..

I pointed you to the answer HERE:-

https://www.access-programmers.co.uk/forums/showpost.php?p=1657123&postcount=57

Why is that post there?

Every month someone falls into the trap that you have.

"WE" inform them of the error, and the necessity to learn a bit more, and restructure their dB.

Most say Ha! there's something I don't know.. Maybe I can learn something, and with a bit of help they turn it around, restructure, and avoid a costly mistake.

But one or two react as you have.

Read my post, the original was posted in 2004, its 15 years old, that's how common this problem is..

ALL of us here, fell into the SAME TRAP !!! We are not trying to belittle you, we just want you to avoid the HOLE we fell in...
 

Micron

AWF VIP
Local time
Yesterday, 19:19
Joined
Oct 20, 2018
Messages
3,478
OK everyone. Let's take a step back. I understand the frustration of those who think their advice is being ignored because it happens to me all the time. When it does, I try to just move on and let someone else deal with it. If you don't like that, let me know and I'll butt out.

I think a legitimate point was made which might be that we're saying "you can't get there from here" without giving any direction. So if I may, here's a few links about "normalization" which is what the point is all about. Tezza444, if you don't appreciate them as the help they're intended to be, then I have failed too. Just realize that the subject is not easily grasped by everyone, or at least the application of the principles are not. If that includes you, do more research and find explanations that speak to you, and by all means, start a new thread with your questions that are focused on that subject and you will likely get some help with it.

Normalization Parts I, II, III, IV, and V
http://rogersaccessblog.blogspot.com/2017/03/what-is-normalization-part-i.html
and/or
http://holowczak.com/database-normalization/

Entity-Relationship Diagramming: Part I, II, III and IV
http://rogersaccessblog.blogspot.com/2009/01/entity-relationship-diagramming-part-i.html

How do I Create an Application in Microsoft Access?
http://rogersaccessblog.blogspot.com/2009/05/how-do-i-create-application-in.html
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Yesterday, 18:19
Joined
Feb 28, 2001
Messages
27,189
Tezza444,

I hear you. Now let me try this answer on you. I'll start with what you have heard, though, because I have to use it for comparison purposes.

When you have data in something that looks like a spreadsheet, Excel has functions that allow you to do comparisons within a range that can be horizontal, vertical, or a little bit of both. Those functions are associated with individual cells. It works from the cell outward because Excel data cells are individually independent. That is, you can put anything you please in an Excel data cell regardless of what is to its left, right, top, or bottom. Granted, if you put a function that looks in one or more of those directions, you have stated some degree of dependence. That dependence, however, has to be repeated for every cell. You have ways to repeat a cell definition, but it has to be repeated individually every time you want to look in other cells, i.e. establish dependence.

Access tables are not Excel data cells. You cannot put a function in an Access table. You only put raw data in tables. When you use Access to do that, you take away certain degrees of data independence. The left and right neighbors to a field in an Access table are still totally independent. However, the data format and interpretation of the items on the next or previous row are now fixed by the way the table was defined.

This vertical "lockdown" occurs because Access works vertically when computing what we call aggregates - SUM, MAX, COUNT, etc. For you to design data that has to be treated horizontally (i.e. find the MAX of several fields in the same row) you are stepping away from what Access does. This is why we tell you that you are choosing a wrong data structure.

The fix to this is normalization - among other things, a way to make your data be aligned vertically for various types of aggregate functions including MAX, MIN, COUNT, etc.

In the case where you had some things on the same row and wanted a horizontal aggregate, the "correct" solution in Access is to have each of those items in the row as members of a CHILD TABLE that associates the individual items with some other part of the row that is the parent of that group of elements.

I'll explain that a bit more. In order for you to perform your horizontal aggregate, the logical implication is that the horizontal group of cells containing the values to be tested are all similar in some way. It is clear that you did not understand this fully. The real significance of this condition is that those items are treated alike - but they are different than other items to the left or right of the range of slots they occupy.

This is a VERY significant concept in normalization because it says that the values in question need to be in a separate table. Things that are treated together need to stay together; things that are treated differently need to stay apart. This "purity of usage" or "purity of purpose" eventually leads you to being able to focus on the properties of things that are kept together and to minimize your concern for interactions with things not kept together. The final goal of normalization is to allow you to see AND EXPLOIT how your data sets' parts relate to each other. A side effect of normalization, when done well, is to reduce the size of your data sets to a minimum by minimizing needless repetition of entries.

I hope that gives you something to think about regarding the advice you were given earlier. I reviewed your posts and only see code relating to a coding issue, but nowhere did you tell us what you were actually trying to do using your words to describe the problem. Now the problem that you have left us with is that we don't have any insight into the real-world problem you are attacking. We don't know enough about the specifics of your problem so can't give you much insight in how to solve it specifically to what you are trying to do.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 19:19
Joined
Feb 19, 2002
Messages
43,293
Welcome aboard. I would suggest starting a new thread. Posting in an old thread just confuses people. So I'm going to close this one.

<note by moderator pbaldy, the content Pat mentioned was cut out to a new thread>
 
Last edited by a moderator:
Status
Not open for further replies.

Users who are viewing this thread

Top Bottom