两个SQL查询之间的不同值
我希望能够找到一天对另一天的数据输入数据之间的任何潜在差异。
相关的col。从表中可以看到:
Name | Size | DateSale | Location | Comments | Date
两个当前查询是:
Select Name, Size, DateSale, Location, Comments from [Table] where Date = '06/02/2022'
Select Name, Size, DateSale, Location, Comments from [Table] where Date = '06/01/2022'
我将如何提出与这两个列表不同的值列表?尝试与Select Distion一起工作,但无法弄清楚。
示例数据:
Name | Size | DateSale | Location | Comments | Date
john | 100 |06/05/2022| Houston | proj. | 06/02/2022
john | 100 |06/04/2022| Dallas | | 06/01/2022
jake | 90 |06/04/2022| Houston | proj. | 06/02/2022
jake | 90 |06/04/2022| Houston | proj. | 06/01/2022
所需结果:
john | 100 |06/05/2022| Houston | proj. | 06/02/2022
由于键(名称 +大小)相同,但是其他类别(销售日期,位置或注释)也有差异,因此它将返回 第一个查询的行(最近日期)
I want to be able to find any potential differences between data inputted on one day to another.
The relevant col. from the table are seen below:
Name | Size | DateSale | Location | Comments | Date
The two current queries are:
Select Name, Size, DateSale, Location, Comments from [Table] where Date = '06/02/2022'
Select Name, Size, DateSale, Location, Comments from [Table] where Date = '06/01/2022'
How would I come up with a list of values that are different from these two lists? Tried working with select distinct but could not figure it out.
Sample Data:
Name | Size | DateSale | Location | Comments | Date
john | 100 |06/05/2022| Houston | proj. | 06/02/2022
john | 100 |06/04/2022| Dallas | | 06/01/2022
jake | 90 |06/04/2022| Houston | proj. | 06/02/2022
jake | 90 |06/04/2022| Houston | proj. | 06/01/2022
Desired Result:
john | 100 |06/05/2022| Houston | proj. | 06/02/2022
Since the keys (Name + Size) are the same, but there are differences in the other categories (Sale Date, Location, or Comments), it will return
the row from the first query (most recent date)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这个解决方案对我有用
This solution worked for me