如何在两个表中查找匹配的行

编程入门 行业动态 更新时间:2024-10-26 21:18:33
本文介绍了如何在两个表中查找匹配的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有两张表,如表1和表2. 表1如下: ID日期类型 1 20/09/2010发票 2 21/09/2010信用 表2有以下内容: ID日期类型 1 20/09/2010发票 2 21/09/2010信用 所以我的查询有如果ID,日期,类型的所有字段都匹配,则提供输出它必须抛出一个批准的消息框,否则它应该说不匹配。请帮助。

I have two Tables say Table 1 and Table 2. Table 1 has following: ID Date Type 1 20/09/2010 Invoice 2 21/09/2010 Credit Table 2 has follwing: ID Date Type 1 20/09/2010 Invoice 2 21/09/2010 Credit So my Query has to give output if all the field that is ID,Date,Type are matching it has to throw a message box approved else it should say Not matching. Please help.

推荐答案

你还没有提供足够的信息来提供一个完整的例子 将table2作为表格缺少表1中的记录 或是否 table1缺少记录 或者它是 table1可能有记录不在表2中 和table2也可能有记录不在表1中 我将假设最简单的你可以调整它以适应你的情况 基本上你加入每个字段上的2个表,然后测试空字段以确定记录是否缺失 我将假设table1总是有每条记录而table2可能会丢失一些 You haven''t provided enough info to give a complete example will table2 be the table that has missing records that are in table 1 or is it table1 that has the missing records or is it table1 might have records not in table2 and table2 might also have records not in table1 I will assume the easiest and you can adjust it to suit your situation Basically you join the 2 tables on each field and then test for null fields to determine if the record is missing or not Im going to assume that table1 always has every record and table2 might be missing some 展开 | 选择 | Wrap | 行号

您好Delerna,非常感谢您的回复。不幸的是它是你提到的第二种情况。也就是说,table1可能有记录不在table2中 而table2也可能有不在table1中的记录。 如果没有不匹配然后它应该抛出一条消息已批准或者它将显示不匹配并突出显示两个表中不匹配的记录。 请帮助。 Hi Delerna,Many thanks for your reply. Unfortunately its the second situation you have mentioned.That is, table1 might have records not in table2 and table2 might also have records not in table1. If there are no mismatch then it should throw a message "Approved" or it will show not matching and highlights the records that are not matching in both the tables. Please help.

如果我给以上编码在查询设计下表达它不起作用。请指导我。我应该写一个事件。 And If i give the above coding in the query design under expression it is not working. Kindly guide me. should I write a event on this.

更多推荐

如何在两个表中查找匹配的行

本文发布于:2023-10-20 08:57:42,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1510513.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:两个   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!