具有其他表中缺少的字段值的处理记录 [英] Process Records With Field Values That Are Missing From Another Table

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

问题描述

我需要扫描表 tblTestCodeFavorites 中的每条记录,以确保表 TestCode 中的值存在于表<代码lang ="text"> testCodes .如果 tblTestCodeFavorites.TestCode 中的值在 testCodes.SomeField 中不存在,那么我需要对该 tblTestCodeFavorites 记录(或记录).

I need to scan each record in the table tblTestCodeFavorites to ensure the value in the field TestCode exists in the table testCodes. If the value in tblTestCodeFavorites.TestCode does not exist in testCodes.SomeField, then I need to perform some processing on that tblTestCodeFavorites record (or records).

推荐答案

SELECT tcf.*
FROM tblTestCodeFavorites tcf
    LEFT JOIN tblTestCodes tc ON tcf.TestCode = tc.SomeField
WHERE tc.SomeField IS NULL; 



上面的SQL语句将为您提取表tblTestCode中的所有记录,在TestCode列中没有与表tblTestCodes的SomeField列匹配的值.遍历这些行,并尽您所能进行任何处理.

最好的问候,

-MRB



Above SQL statement will fetch you all the records in table tblTestCodeFavorites that don''t have values in column TestCode that would match column SomeField in table tblTestCodes. Loop through these rows and do whatever processing your heart may desire.

Best Regards,

-MRB


这篇关于具有其他表中缺少的字段值的处理记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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