比较2个表并显示使用特定条件不匹配的记录数 [英] Compare 2 Tables and show how many records do not match using specific criteria

查看:72
本文介绍了比较2个表并显示使用特定条件不匹配的记录数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两张桌子。一张表是2016年,另一张表是费率。我有两个表[City] [Hotel]和[Rate]匹配的3个字段。我想要做的是计算2016年表中[费率]与费率表上的[费率]不匹配的数字记录,但城市和酒店确实匹配。可以提供任何可以提供的帮助

I have two tables. One table is 2016 and the other table is rates. I have 3 fields that match in both tables [City] [Hotel] and [Rate]. What I would like to do is count the number records that the [Rate] in the 2016 table doesn''t match the [Rate] on the rate table, yet the cities and hotels do match. Any help that can be provided would be appreciated

推荐答案

在要匹配的字段上加入2个表,并使用WHERE子句过滤您不喜欢的字段我想匹配。
Join the 2 tables on the fields you want to match and use the WHERE clause to filter on the field you don''t want to match.


我认为WHERE子句用于匹配特定条件,例如WHERE Dept =''Sales''这里是我要做的一个例子。

Table 2016桌子价格

亚特兰大Motel6 49.50亚特兰大Motel6 65.00

亚特兰大Motel6 65.00

亚特兰大Motel6 65.00


我要找的是Motel6在65.00收费的次数。我还会使用WHERE吗?如果是这样的话,我可能需要帮助WHERE语句
I thought the WHERE clause was use to match specific criteria such as WHERE Dept = ''Sales'' here is an example of what I am looking to do.
Table 2016 Table Rate
Atlanta Motel6 49.50 Atlanta Motel6 65.00
Atlanta Motel6 65.00
Atlanta Motel6 65.00

What I am looking for is a count of how many times the Motel6 was charged at 65.00. Would I still use WHERE for this? if so, I may need help with the WHERE statement


它发布时没有出现。


表2016

亚特兰大Motel6 49.50

亚特兰大Motel6 65.00

亚特兰大Motel6 65.00


桌价


亚特兰大Motel6 65.00
That didn''t come out right when it posted.

Table 2016
Atlanta Motel6 49.50
Atlanta Motel6 65.00
Atlanta Motel6 65.00

Table Rate

Atlanta Motel6 65.00


这篇关于比较2个表并显示使用特定条件不匹配的记录数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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