本文介绍了帮助请求“NOT EXISTS”的有效替代方案或“不在”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在MS Access中,我正在寻找一种有效的方法来返回记录,其中与另一个表相比,一个表中的字段值不存在。我可以使用NOT EXISTS或NOT IN来执行此操作,但它们始终可以运行。


我一直在寻找左脑和右脑,但是在这个过程中已经摧毁了太多的脑细胞,现在我完全糊涂了!


我有两张桌子(描述鸟群的情况!)。


Bird Sightings主表(表1)中的相关字段是SPECIES,SQUARE和TETRAD,描述了非常多的鸟类物种和2k地理广场(Square和Tetrad)。见表。


表2包含字段SQUARE,TETRAD和FLAG,列出县内及周围所有可能的SQUARES和TETRAD,其中flag字段中的Y表示四分之一完全位于县界。


我希望能够选择SPECIES,SQUARE和TETRAD来识别那些物种没有目击的SQUARE和TETRAD(对于FLAGYTetrads只有)。


请问有人建议使用效率最高的SQL吗?


非常感谢您的预期

Phil Davis

Hi, in MS Access, I am looking for an efficient way of returning records where field values in one table are NOT present when compared to another table. I can do this using NOT EXISTS or NOT IN but they take for ever to run.

I''ve been looking a LEFT and RIGHT JOINs but have destroyed too many brain cells in the process and am now totally confused !

I have two tables (that describe Bird Populations as it happens!).

The relevant fields in the main Bird Sightings table (Table 1) are SPECIES, SQUARE and TETRAD which describe very many bird species sightings and the 2k geograpical squares (Square and Tetrad) they were seen in.

Table two contains fields SQUARE, TETRAD and a FLAG that lists all possible SQUARES and TETRADs in and around the County where a Y in the flag field denotes the tetrad being wholly within the county boundary.

I''d like to be able to select SPECIES, SQUARE and TETRAD identifying those SQUAREs and TETRADs where the Species has no sightings (for FLAG "Y" Tetrads only).

Could anybody suggest the most efficient SQL to do this please?

Many thanks in anticipation
Phil Davis

推荐答案




这篇关于帮助请求“NOT EXISTS”的有效替代方案或“不在”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 16:03