本文介绍了比较两个表中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个用于跟踪患者的表,每个表包含特定于医疗问题的数据。问题只是略有关联,并没有太多共同的领域。将它们放在一张表中是不切实际的。我为每个
表格生成一个qry,用于生成唯一的患者标识符。当患者出现在每个表中时,每个表都是相同的。

I have two tables for tracking patients, each table contains data specific to a medical issue. The issues are only slightly related and do not have too many fields in common. Putting them in a single table would be impractical. I have a qry for each table that generates a unique patient identifier. This would be the same for each table when the patient appears in each one.

示例

Qry 1

日期             PTID

Date             PTID

1/1/208      32567SD

1/1/1980      32567SD

1/2 / 1980      12345FE

1/2/1980      12345FE

1/1/208      32567SD

1/1/1980      32567SD

Qry 2

日期             PTID

Date             PTID

1/1/191      32567TR

1/1/1981      32567TR

1/2 / 1980      12345FE

1/2/1980      12345FE

1/1/208      32567SD

1/1/1980      32567SD

我正在尝试构建一个将执行以下操作的Qry。

I am trying to build a Qry that will do the following.

每个qry中出现的PatientIdentifier的次数,次数是多少次Qry2中的Qry 1和#次

How many times the PatientIdentifier appears in each qry, # of times in Qry 1 and # of times in Qry2

来自Qry 1的患者标识符出现在Qry 2和From 2 in 1中的次数

How many times the patient identifier from Qry 1 appears in Qry 2 and From 2 in 1

如何很多时候,患者标识符在表2中出现的日期后显示在表1中

How many times the patient identifier shows up in table 1 after the date it appears in table 2

我在想创建一个Union Qry可能是最好的方法,但我想先在这里发布,看看是否有人可能有更好的解决方案。

I was thinking that creating a Union Qry might be the best approach but thought I would post it here first to see if someone might have a better solution.

提前谢谢你。

Jason

推荐答案

我'我不确定UNION查询会这样做。我想也许你需要查询每个查询的DISTINCT患者标识符。然后,您可以使用唯一标识符列表来计算您的计数。

I'm not sure a UNION query will do it. I think maybe you'll need a query of DISTINCT patient identifier for each query. Then, you can use the list of unique identifiers to do your counts.

只需要我的2美分......

Just my 2 cents...


这篇关于比较两个表中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 16:15