MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can I use CASE in...

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
viji
Beginner


Joined: 03 Dec 2002
Posts: 17
Topics: 11

PostPosted: Wed Jul 23, 2003 12:59 am    Post subject: How can I use CASE in... Reply with quote

Hello,
Consider
I have a EMPLOYEE table with employeeID,InsuranceID,Employee Name,ClaimNo....

I have nearly 3 Insurance company....Each Insurance company different tables to store all its details like ClaimNo,PaymentDate,...Here ClaimNo is the unique key.

My requirement is depending on the InsuranceID i have to take the details from the corresponding Insurance table. Right now, i am reading the EMPLOYEE table and if the InsuanceID=1 then i have a separate SQL to read the InsuranceTable1 and if InsuranceID=2 then i have another separate SQL to read InsuranceTable2.....

Can I combine all these queries into a single query using CASE statement?
Back to top
View user's profile Send private message
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Wed Jul 23, 2003 9:24 am    Post subject: Reply with quote

Viji,
You can try a simple join(better have a good filtration criteria). A csae statment in the WHERE clause is not indexable and will be a performance drag. Consider a UNION if appropriate.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group