Re: classify

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



There are obviously two problems.

The first one is about 3.9999 falling nowhere, unless High_Avg = Low_Avg of some other record, AND that you relinquish BETWEEN operator and use

WHERE Average >= Low_Avg AND Average < High_Avg;


note the strict <, not <= that BETWEEN would imply.

The second problem is more disputable but it is one of maintenance and of strict independence of the data from one record to the other. As example, what happens if, starting with:


Low_Avg High_Avg
0 4
4 4.75
4.75 9
9 32000


the first record is changed to

0 4.5


without changing the second record?


Sure, there are cases where such overlap is WHAT YOU MAY WANT, example:
Low High Category
0 2 baby
2 18 child
18 75 adult
75 200 elder
2 12 young
12 18 teenager


in cases where you may want stats from 2 to 18 as a group, but also, with the two sub-group young / teenagers. Which you get, here, with just one query (using an inner join)


But I doubt that the OP case is such a case.


Sure, this problem of potential of overlapping intervals can be deal with by other means, and while, I personally consider that the order of complexity that the fully normalized case bring does NOT worth its benefit, in general, myself I use the not fully normalized Low / High fields, it is nice to know the potential problems linked to that kind of design.




Vanderghast, Access MVP





"KARL DEWEY" <KARLDEWEY@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:5E720B4B-99EB-4961-9CD8-43FB2D938134@xxxxxxxxxxxxxxxx
Create a table that defines the range, and you can then create a query to
look up that table and return the range number.
It takes a bit of effort to get this kind of query working.
Translation table --
Low_Avg High_Avg Classification
0 3.99 1
4.0 4.75 2
4.76 8.99 3

I find it easy, something like this --
SELECT [YourFields], [Classification]
FROM YourTable, Translation
WHERE Average Between Low_Avg AND High_Avg;

--
Build a little, test a little.


"Allen Browne" wrote:

Your ranges don't look like a simple, linear scale, so it can't be done with
a simple expression. Create a table that defines the range, and you can then
create a query to look up that table and return the range number.

It takes a bit of effort to get this kind of query working. Tom Ellision
explains how in this article:
Lookup in a range of values in a query
at:
http://allenbrowne.com/ser-58.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


"Miriam" <Miriam@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:B34B564E-6955-41EB-8863-EB38810773DE@xxxxxxxxxxxxxxxx
> After calculating an average, I need to classify each member as 1, 2, > 3,
> ...
> 10. 1 = an average of 3.99 or lower, 2 = an average of 4.0 - 4.75, > etc.
>
> How can I set a field to a particular classification, or "handicap", > based
> on given ranges? Does this require coding or VBA, or can it be done
> through a query?


.


.



Relevant Pages

  • Re: Classification, Hierarchies & Adaptive Clustering
    ... > I guess we are picturing different situations here, ... The previous query should ... SQL query, therefore, is both more flexible and more presize. ... I'm by no means an expert on this, but what is classification? ...
    (comp.theory)
  • Re: classify
    ... It takes a bit of effort to get this kind of query working. ... FROM YourTable, Translation ... How can I set a field to a particular classification, or "handicap", based ...
    (microsoft.public.access.queries)
  • Re: Adding records from a table and a query
    ... I then sent information to one geographical area and classification, such as public houses in Cardiff. ... I would first set up a Query that includes the field and any others that will help to identify the record in a meaningful way. ... To set up a subform, look up "Create a subform and add it to an existing form" in MS Access Help. ... What would be better would be to already have a table somewhere -- if not in Access, then perhaps in Excel or Word or just plain text -- that lists the [contactIDno] values and the corresponding values. ...
    (microsoft.public.access.queries)
  • Re: Demographics
    ... may strongly disagree with your classification. ... After you have the proper grouping you simply use a 'groupby' query. ... report as desired. ... it to report a running sum or group sum. ...
    (microsoft.public.access.gettingstarted)
  • Re: Database design question
    ... The query can be created with the QBE ... The calculated cost is not saved in the ... I want the user to enter the classification and a square foot amount ...
    (microsoft.public.access.tablesdbdesign)