• Subject: SQL Existence Check
  • From: "Walden Leverich" <walden@xxxxxxxxxxxxxxx>
  • Date: Fri, 14 Nov 1997 12:23:45 -0500

I would like to check for the existence of a record in a file using SQL.
There could be 0, 1 or more than 1 records that match the selection
criteria, I only care if records exist, not how many.

I know that SQL has the EXISTS predicate, but I cannot use it by itself, it
must be in the where clause of a statement. I realize that I could do a
select count(*) where.... but this would require DB2/400 to read all the
matching records in order to count them. In my case as soon as DB2 finds 1
record it can stop looking.

Any suggestions?

-Walden

PS. Yes, I know a single chain or setll would accomplish this. I am looking
for a SQL solution.


+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to "MIDRANGE-L@midrange.com".
| To unsubscribe from this list send email to MAJORDOMO@midrange.com
|    and specify 'unsubscribe MIDRANGE-L' in the body of your message.
| Questions should be directed to the list owner/operator: david@midrange.com
+---


This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 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].