如何对访问查询中的值范围进行分类 [英] How to classify ranges of values in access query

查看:22
本文介绍了如何对访问查询中的值范围进行分类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我目前遇到了一个问题.任何帮助将不胜感激.我要分类的数据的权重范围为 0-80.如果订单项介于 0-19 之间,则将其标记为 19-39 中型,等等......我正在努力寻找如何让它发挥作用的起点.此查询从数据源中提取多个字段,但这是唯一被修改的字段.在此之后,数据将根据光、中等重新分类.

Hello I am currently stuck on a problem. Any help will be appreciated. The data I am looking to classify are weights ranging from 0-80. If the line item is between 0-19 tag it as light 19-39 medium, etc... I am struggling for a starting point for how to get this to work. This query is pulling multiple fields from the data source but this is the only one that is being modified. After this the data will be re-classified based on light, medium, etc.

感谢您的帮助.让我知道是否需要任何东西

Thanks for the help. Let me know if anything is needed

推荐答案

您可以制作一个名为 WeightClasses

然后你可以加入这个

Select t.*, wc.weightclassname
From Things as t
inner join WeightClasses as wc 
    on t.Weight >= wc.LowerBound and t.Weight < wc.UpperBound

这会产生这样的结果

我认为这比 IIF 语句更易于阅读和审核.您可以在不更改代码的情况下更改表格中的分类,并且可以通过查看表格快速轻松地了解您的类.您还可以通过添加新记录来添加体重等级.

I think this is a lot easier to read and auditable than IIF statements. You can change your classifications in a table without changing code and you can make sense of your classes very quickly and easily by looking at the table. You can also add weight classes just by adding new records.

这篇关于如何对访问查询中的值范围进行分类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆