IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

what where exists and not exists will do in SELECTstatement?


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
shivakumar .b
Warnings : 1

New User


Joined: 11 May 2005
Posts: 18
Location: bangalore

PostPosted: Wed May 11, 2005 5:11 pm
Reply with quote

hi everybody,
This is shivakumar.
I want to know what the WHERE EXISTS AND WHERE NOT EXISTS will do in SELECT statement, that is i want to know for what purpose we are using this exists clause.
i am waiting for reply.
thanks in advance.
Back to top
View user's profile Send private message
priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1448
Location: Chicago, IL

PostPosted: Wed May 11, 2005 5:16 pm
Reply with quote

Check the link...

Quote:
http://www.ibmmainframes.com/viewtopic.php?t=387&highlight=exists


Regards,
Priyesh.
Back to top
View user's profile Send private message
ajay_dheepak

New User


Joined: 12 May 2005
Posts: 32
Location: Chennai

PostPosted: Thu May 19, 2005 5:31 pm
Reply with quote

consider the following query

SELECT EMPNO,LASTNAME
FROM TABLE1
WHERE EXISTS
(SELECT *
FROM TABLE2 WHERE BDATE < '1986-01-01');

The above query returns all the EMPNO and LASTNAME if there is any BDATE in TABLE2 which is less than '1986-01-01'.
Back to top
View user's profile Send private message
shivakumar .b
Warnings : 1

New User


Joined: 11 May 2005
Posts: 18
Location: bangalore

PostPosted: Fri May 20, 2005 10:55 am
Reply with quote

HELLO AJAY_DHEEPAK, THANK U VERY MUCH FOR U R REPLY.
YOU HAVE MENTIONED A VERY GOOD EXAMPLE. THANKS A LOT.
BYE
REGARDS,
B.SHIVAKUMAR
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Start CICS but A STORAGE SHORTAGE EXISTS CICS 2
No new posts HOW TO INCREASETHE GDG LIMIT ,WHICH E... JCL & VSAM 7
No new posts DUPLICATE NAME EXISTS IN CATALOG problem JCL & VSAM 13
No new posts To find whether a TAPE file exists, u... JCL & VSAM 1
No new posts SQL to check, if an Employee# exists ... DB2 5
Search our Forums:

Back to Top