比较一个表中的记录 [英] Comparing records in one table

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

问题描述

有人可以帮我写一个查询或代码,允许我根据季度比较记录吗?


例如,在我的表中,所有记录都将PK设置为( DCN& Quarter)。 DCN通常在四分之一到另一个季度相同。但是,3个字段可能会改变(成本基础,使用寿命和开始日期)。


我希望能够允许用户输入他们想要比较的2个季度然后会有一份报告显示来自2个选定季度的DCN的变化。


现在我有多个不同季度的表,我运行的是一些不匹配的查询。这种技术是非常用户友好的cus我需要为我想要比较的每个季度组合创建一个新的查询表。


如果我不清楚,请告诉我解释这个。

Could someone help me write a query or code that allows me to compare records based on the quarter?

For example, in my table all the records have the PK set as (DCN & Quarter). The DCN is usually the same from one quarter to another. However, 3 fields could change (cost basis, useful life, and start date).

I want to be able to allow a user to enter the 2 quarters they want to compare and then there will be a report showing the changes in DCN''s from the 2 selected quarters.

Right now I have multiple tables with the different quarters and I am running somewhat of an unmatched query. This technique is very un-user friendly cus I would need to create a new query with the tables for every combination of quarters I want to compare.

Let me know if I am unclear in explaining this.

推荐答案

对此有任何建议。谢谢。
Any suggestions on this. Thanks.



有人可以帮我写一个查询或代码,让我可以根据季度比较记录吗?
<例如,在我的表中,所有记录都将PK设置为(DCN& Quarter)。 DCN通常在四分之一到另一个季度相同。但是,3个字段可能会改变(成本基础,使用寿命和开始日期)。


我希望能够允许用户输入他们想要比较的2个季度然后会有一份报告显示来自2个选定季度的DCN的变化。


现在我有多个不同季度的表,我运行的是一些不匹配的查询。这种技术是非常用户友好的cus我需要为我想要比较的每个季度组合创建一个新的查询表。


如果我不清楚,请告诉我解释这个。
Could someone help me write a query or code that allows me to compare records based on the quarter?

For example, in my table all the records have the PK set as (DCN & Quarter). The DCN is usually the same from one quarter to another. However, 3 fields could change (cost basis, useful life, and start date).

I want to be able to allow a user to enter the 2 quarters they want to compare and then there will be a report showing the changes in DCN''s from the 2 selected quarters.

Right now I have multiple tables with the different quarters and I am running somewhat of an unmatched query. This technique is very un-user friendly cus I would need to create a new query with the tables for every combination of quarters I want to compare.

Let me know if I am unclear in explaining this.



嗨。那么这不是一个简单的答案。我们需要从表格设计开始。你说PK是(DCN& Quarter)并且DCN通常是相同的。这意味着在获得重复值之前,您只能在表中输入4行。除非您计划加入查询中的一个或多个其他表,否则我们应该删除PK。


quarter和dcn的数据类型是什么?

Hi. Well this is not going to be an easy answer. We need to start with the table design. You say that the PK is (DCN & Quarter) and that DCN is usually the same. This means that you can only enter 4 rows in the table before you get duplicate values. Unless you are planning to join to one or more other tables in your query we should drop the PK.

What are the data types for quarter and dcn?



嗨。那么这不是一个简单的答案。我们需要从表格设计开始。你说PK是(DCN& Quarter)并且DCN通常是相同的。这意味着在获得重复值之前,您只能在表中输入4行。除非您计划加入查询中的一个或多个其他表,否则我们应该删除PK。


quarter和dcn的数据类型是什么?
Hi. Well this is not going to be an easy answer. We need to start with the table design. You say that the PK is (DCN & Quarter) and that DCN is usually the same. This means that you can only enter 4 rows in the table before you get duplicate values. Unless you are planning to join to one or more other tables in your query we should drop the PK.

What are the data types for quarter and dcn?



DCN和Quarter都是文本字段。 DCN与所有时间的记录保持不变。记录中的字段可以更改,但DCN不会。每个季度每个DCN有一个实例,这就是它的独特之处。


顺便提一下,第一季度大约有980个不同的DCN。这个数字可能会上升或下降,具体取决于我们是删除某个DCN还是添加一个DCN。我只关注那些在第2季仍然存在并且运行查询的问题,该查询将显示从2个季度做出的任何更改。

DCN and Quarter are both Text fields. The DCN remains constant with the record for all of time. There are fields in the record that can change but the DCN wont. There is 1 instance of each DCN every quarter this is what makes it unique.

By the way there are about 980 different DCN''s in quarter 1. That number could go up or down depending on if we delete a certain DCN or add one. I am only concerned with the ones that are still there in quarter 2 and running a query that will show any changes made from the 2 quarters.


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

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