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 tblCorresponden ce
AS tblC
WHERE tblC.CustID = tblCorresponden ce.CustID AND tblC.OutType = "01")
AS
LogicalField FROM tblCorresponden ce WHERE tblCorresponden ce.OutType
=
"05"
Nov 13 '05
15 1916
"lylefair" <ly******@yahoo .ca> wrote in
news:11******** **************@ f14g2000cwb.goo glegroups.com: No. Query16 returns only one row with all the fields from both Table1 and Table2. This row has both Table1.ID and Table2.Number = 9. This is the only match that exists.
Query15 also returns one row, but only the fields of Table1 are included.
Right. In the real world, there is often a need to return only
the rows from one table which meet a criterium which exists in
one or more rows of a second table. If there are more than one
row, a join will return duplicate values. Using EXISTS will
result in the query returning rows from table 1 only the number
of rows in table one which match the criterium.
Using the DISTINCT keyword in the query will also return only
the rows meeting the criterium, but that will be less efficient
as the database engine must create a scratch table then compress
that to the final result.
--
Bob Quintal
PA is y I've altered my email address.
I think you misread what I said, for the second or third time in this
thread.
If you want to make some point about exists and joins then by all means
do it, but I would appreciate it if you did independently of the point
I am trying to make, which is that Exists in JET may be inefficient.
I don't want to do anything with these queries. I created them only to
see their JET compilation plan.
If you want to discuss you point then I ask:
Can you post in full a query string where EXISTS will do something more
effectively or efficiently than a JOIN? (assuming JET 4.0).
"lylefair" <ly******@yahoo .ca> wrote in
news:11******** **************@ g49g2000cwa.goo glegroups.com: I think you misread what I said, for the second or third time in this thread.
If you want to make some point about exists and joins then by all means do it, but I would appreciate it if you did independently of the point I am trying to make, which is that Exists in JET may be inefficient.
I don't want to do anything with these queries. I created them only to see their JET compilation plan.
If you want to discuss you point then I ask:
Can you post in full a query string where EXISTS will do something more effectively or efficiently than a JOIN? (assuming JET 4.0).
I'll have to assume Jet 3.51, went back to Access '97 because of
crap in '2000.
select invoice_no from invoice where exists (select * from
invoice_line where shipped_date is null and invoice.invoice no=
invoice_line.in voice_no);
vs:
select distinct invoice_no from invoice , invoice_line inner
join invoice.invoice no = invoice_line.in voice_no where
invoice_line where shipped_date is null;
--
Bob Quintal
PA is y I've altered my email address.
"lylefair" <ly******@yahoo .ca> wrote in
news:11******** **************@ g43g2000cwa.goo glegroups.com: Reading the rest of your post: of course,this is not MY plan. It is JET's compilation plan and manifests itself in showplan.out after inserting this key in the registry:
[HKEY_LOCAL_MACH INE\SOFTWARE\Mi crosoft\Jet\4.0 \Engines\Debug] "JETSHOWPLAN"=" ON"
And as speedy as what? I didn't say it was speedy and I don't know if it's speedy. We were discussing whether or not JET optimizes The EXISTS operator. After looking at the compilation plan my guess is ... probably not.
ShowPlan never shows subquery optimizations -- it says somewhere in
the ShowPlan output, I believe, that subquery optimization is not
shown, that MS never got around to implementing it.
That is, if I'm remembering correctly.
--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Yes, I think you are right. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Newbie |
last post by:
Hi,
Could someone please tell how MINUS operator works for comparing and
giving non-matching records in Table1? Does MINUS operator compares
all records of Table1 with all records of Table2 to give differences?
Say, i've got 2 tables - no keys defined on them. No PK and UK. Now
MINUS operator will pick which columns for comparison? Having a PK/UK,
i see it as comparing these keys and susequently the rest of fields
for matcing key records,...
|
by: Edward Diener |
last post by:
Is there a way to override the default processing of the assignment operator
for one's own __value types ? I realize I can program my own Assign method,
and provide that for end-users of my class, but I would like to use
internally my own = operator for some of my value types, so I can say "x =
y;" rather than "x.Assign(y);".
The op_Assign operator seems impossibly broken since it takes __value copies
of the two objects. Perhaps there is...
|
by: Pmb |
last post by:
I've been working on creating a Complex class for my own learning purpose
(learn through doing etc.). I'm once again puzzled about something. I can't
figure out how to overload the assignment operator.
Here's what I'm trying to do. I've defined class Complex as
class Complex {
friend ostream &operator<<( ostream &, Complex & );
public:
Complex( float = 0.0, float = 0.0 );
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I debug
it in PHP designer, it works with no problems, I get the test email. If
|
by: Javier Estrada |
last post by:
1. For types smaller than int, when I compile:
class MyClass
{
static void Main(string args)
{
x = 10;
y = -x;
}
| |
by: Chad Crowder |
last post by:
Getting the following error on my production server whether the file exists
or not:
"System.IO.IOException: Cannot create a file when that file already exists."
Here's the code generating the error (seems to be happening when I try
creating a directory)
If dirmgr.Exists("s:\blah\" & txt_name.Text) Then
lblerror.Text = lblerror.Text & "Unable to build physical path. " &
|
by: Geoff Jones |
last post by:
Hi
I'm trying to drop a table by using:
Dim cmd As New OleDbCommand("DROP TABLE IF EXISTS books", myconnection)
cmd.ExecuteNonQuery()
but I get a syntax error: "Syntax error in DROP TABLE or DROP INDEX"
|
by: scroopy |
last post by:
Is it impossible in C++ to create an assignment operator for classes
with const data? I want to do something like this
class MyClass
{
const int m_iValue;
public:
MyClass(int iVal):m_iValue(iVal){}
|
by: clicwar |
last post by:
A simple program with operator overloading and copy constructor:
#include <iostream>
#include <string>
using namespace std;
class Vector {
private:
float x,y;
public:
Vector(float u, float v);
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |