|
No, he's saying it's not functioning the way you think it is.
Charles
On Thu, Dec 6, 2012 at 12:52 PM, Stone, Joel <Joel.Stone@xxxxxxxxxx> wrote:
So - you are stating that the SQL I presented CANNOT function? But it
does. It returns a set based on the EXISTS .
I don't understand.
-----Original Message-----
From: midrange-l-bounces@xxxxxxxxxxxx [mailto:
midrange-l-bounces@xxxxxxxxxxxx] On Behalf Of CRPence
Sent: Thursday, December 06, 2012 11:50 AM
To: midrange-l@xxxxxxxxxxxx
Subject: Re: SQL help with EXISTS
On 06 Dec 2012 11:06, Stone, Joel wrote:
I don't think that is correct. It seems to do the subselect (returnThe documentation states explicitly that the "values returned by the
a set of rows) and THEN join the result to the outer select. A few
responses have stated what you said - that EXISTS simply returns TRUE
or FALSE. But I think that it must do this for each row in the outer
select in the case where a join is occurring?
Maybe I am wrong, I don't know SQL and it is elusive and powerful and
complex so I don't understand all the subtleties.
Dan Kimmel on Thursday, December 06, 2012 11:01 AM wrote:
The EXISTS says "are there any". You get the same results in the
outer select whether there's one or many results from the
subselect.
fullselect [of the EXISTS predicate] are ignored" and states clearly
that the only possible results are True and False. No type of matching
join can be done without some values against which to compare; that
would leave only a cartesian product join, and that certainly would be
of no value to the query.
IBM i 7.1 Information Center -> Database -> Reference -> SQL reference
-> Language elements -> Predicates
_i EXISTS predicate i_
http://publib.boulder.ibm.com/infocenter/iseries/v7r1m0/topic/db2/rbafzexists.htm
"The EXISTS predicate tests for the existence of certain rows.
>>-EXISTS--( fullselect )---------------------------------><
The fullselect may specify any number of columns, and
* The result is true only if the number of rows specified by the
fullselect is not zero.
* The result is false only if the number of rows specified by the
fullselect is zero.
* The result cannot be unknown.
The values returned by the fullselect are ignored.
..."
--
Regards, Chuck
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
________________________________________________________________________
This inbound email has been scanned for all viruses by the MessageLabs
SkyScan
service.
________________________________________________________________________
______________________________________________________________________
This outbound email has been scanned for all viruses by the MessageLabs
Skyscan service.
For more information please visit http://www.symanteccloud.com
______________________________________________________________________
--
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.