本文介绍了A97 SQL中的EXISTS运算符 - 我在A97帮助中找不到它的文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Leigh Purvis先生给了我一个非常聪明的SQL来完成什么

可能是一个不常见的目标。在其中,他使用EXISTS操作符。

我在A97帮助中找不到关于它的文档。我想阅读更多关于这个有用的SQL运算符的
。建议?

SELECT CustID,OutType,EXISTS(SELECT CustID FROM tblCorrespondence

AS tblC

WHERE tblC.CustID = tblCorrespondence。 CustID AND tblC.OutType =" 01")

AS

LogicalField FROM tblCorrespondence WHERE tblCorrespondence.OutType

=

" 05"

解决方案





看到最多人们使用exists(select * from ...),看起来资源好了b $ b饥饿但是SQL Server实际上并没有选择这个

实例中的所有列。不确定Access会做什么。


你必须自己测试,但你可能会发现使用DCount()(或

我的tCount() )更有效地对抗Access表,YMMV。



Mr Leigh Purvis gave me a very clever piece of SQL to accomplish what
is probably an uncommon objective. In it, he uses the EXISTS operator.
I can find no documentation on it in A97 HELP. I would like to read
more about this useful SQL operator. Suggestions?

SELECT CustID, OutType, EXISTS (SELECT CustID FROM tblCorrespondence
AS tblC
WHERE tblC.CustID = tblCorrespondence.CustID AND tblC.OutType = "01")
AS
LogicalField FROM tblCorrespondence WHERE tblCorrespondence.OutType
=
"05"

解决方案



http://msdn.microsoft.com/library/de...lce_exists.asp

SQL Server does a great job of optimising this, IME Access does not, I
see most people use exists(select * from...), which looks resource
hungry but SQL Server doesn''t actually select all columns in this
instance. Not sure what Access does though.

You''ll have to test for yourself but you might find using DCount() (or
my tCount()) to be more efficient against Access tables, YMMV.




这篇关于A97 SQL中的EXISTS运算符 - 我在A97帮助中找不到它的文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 00:28