Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Query to display columns which is not existing in that table

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
kalinga

New User


Joined: 25 May 2005
Posts: 4
Location: chennai,india

PostPosted: Wed May 25, 2005 4:30 pm    Post subject: Query to display columns which is not existing in that table
Reply with quote

hi,
My query goes like this,
I have a table say payroll_table, in that the queries i can tell are emp_id, sal_emp, Loc_emp.

now my query is i gave 4 inputs like emp_id's 100,200,998,999.
now i want to display the emp_id's which is not existing in that table with respect to what i given as input.

plz help me i struck up here.
kalinga
Back to top
View user's profile Send private message

vasanthanc

New User


Joined: 01 Apr 2005
Posts: 58

PostPosted: Wed May 25, 2005 4:55 pm    Post subject:
Reply with quote

To display emp_id s which are not in the table, you need to have a master table which has all the emp_ids, then you can use minus query to get the result.

select emp_id from emp_mas MINUS Select emp_id from payroll_table
Back to top
View user's profile Send private message
parikshit123

Active User


Joined: 01 Jul 2005
Posts: 269
Location: India

PostPosted: Wed May 24, 2006 4:06 pm    Post subject:
Reply with quote

well,

select * from payroll_table
where emp_id not in (100,200,998,999) ;

Please let me know if this query fails icon_smile.gif

Thanks,
Parikshit.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
No new posts Display ZEDLMSG without Pressing F1 &... anandgbe CLIST & REXX 8 Thu Dec 15, 2016 4:20 pm
No new posts SQL query to run through list of valu... Ni3-db2 DB2 14 Wed Dec 14, 2016 9:52 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us