根据特定条件处理不同的记录 [英] Manipulating distinct records based on certain conditions

查看:48
本文介绍了根据特定条件处理不同的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


[Access 2003]


我正在处理数据以确定记录是否在给定的情况下完成大体时间。我正在试图弄清楚如何评估具有相同ID的记录,但在其他字段中有不同的数据,以获得该ID的合规性。


这里'要点......数据库跟踪医院患者的信息。出院时,对患者的图表进行评估,以确保图表中的每个表格都符合要求。所有患者都进入数据库,但只有那些具有不合规表格的患者才会进入表格表格。具有不合规形式的患者可能有一种形式或20种不合规的形式。


我的最终目标是创建一个交叉表查询,向我显示图表的数量兼容(在此查询中为null,因为没有form = compliance)以及患者所在的程序不符合的表单数量。


我遇到问题的部分是将查询中的数据用于具有多种形式的一名患者,检查每种形式是否合规,然后返回不符合要求的表格数量。如果一个表格不合规,那么该患者的整个图表就不合规了。我有几个用于确定合规性的表达式,它们显示ITF或NITF(在时间范围内/不在时间范围内)。


只是为了好的衡量,这里是我的SQL,但如果有些需要改变,我不会感到惊讶。我主要包括它,所以每个人都可以看到到目前为止使用的字段和表达式:

展开 | 选择 | Wrap < span class =codeDivider> | 行号

解决方案

< blockquote>解密SQL需要一些时间。你有一个表和字段列表,标识主键和外键吗?


Beacon,


我已经重组了你的SQL所以它更容易阅读。


我建议,任何涉及的SQL都值得格式化,以便在发布之前可读。这当然取决于你,但如果人们更容易看到它的含义,那么人们更有可能看到它;)


对。现在我已经读过几次问题,试图得到你真正想要的东西,我发现你几乎肯定需要提供一些额外的信息。


为了能够提供帮助,我们主要需要两件事:

  1. 指示我们期望从中工作的数据。表格的布局非常重要。
  2. 您需要帮助的一些清晰度。您在答案中寻找什么?

如果您能提供这些信息,我们可以再看看我们能为您做些什么。


Hi everybody,

[Access 2003]

I''m working with data to determine if records were completed in a given timeframe. I''m trying to figure out how I can assess records with the same ID, but have different data in other fields to, to come up with compliance for that ID.

Here''s the gist...the database tracks info for patients at a hospital. Upon discharge, the charts for the patients get assessed to make sure that each of the forms in the chart are compliant. All patients are entered into the database, but only those that have non-compliant forms are entered in a forms table. The patients that have non-compliant forms may have one form or 20 forms that are non-compliant.

My ultimate goal is to create a crosstab query that will show me the number of charts that are compliant (which would be null in this query because no forms = compliant) and the number of forms that are out of compliance for the program that the patient was housed on.

The part I''m having trouble with is taking the data in the query for one patient that has multiple forms, checking each for compliance, and then returning the number of forms that aren''t in compliance. If one form isn''t compliant, then the entire chart for that patient is out of compliance. I have a couple of expression used to determine compliance and they display ITF or NITF (in time frame/not in timeframe).

Just for good measure, here''s my SQL, but I wouldn''t be surprised if some of it needs to be changed. I''m mostly including it so everyone can see the fields and expressions used thus far:

Expand|Select|Wrap|Line Numbers

解决方案

It would take some time to decipher that SQL. Do you have a list of your tables and fields, identifying primary and foreign keys?


Beacon,

I''ve reorganised your SQL so that it''s easier to read.

I suggest, any SQL as involved as that is worth formatting to be readable before posting. It''s up to you of course, but people are more likely to look at it if it''s easier to see what it''s saying ;)


Right. Now I''ve read the whole question through a few times to try to get what you''re actually asking for, I find that you will almost certainly need to provide some extra information.

To be able to help, we would need two things mainly :

  1. An indication of the data that we''re expected to work from. The layout of the tables is of main importance.
  2. Some clarity about which bit you need help with. What are you looking for in an answer?

If you can provide these bits of information we can have another look to see what we can do for you.


这篇关于根据特定条件处理不同的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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