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 

Maximum Salary amount

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


Joined: 21 Nov 2005
Posts: 19
Topics: 10
Location: India

PostPosted: Fri Apr 11, 2008 3:50 am    Post subject: Maximum Salary amount Reply with quote

I have a Employee table, it consists empid,and 12 columns to store their monthly salary. Now i want to know the Max salary for an employee among the 12 months.

Please help me in getting the ans.

Many Thanks
_________________
Brijesh(India Is Great)
Back to top
View user's profile Send private message AIM Address Yahoo Messenger
videlord
Beginner


Joined: 09 Dec 2004
Posts: 147
Topics: 19

PostPosted: Fri Apr 11, 2008 9:48 am    Post subject: Reply with quote

use CASE, e.g.
Code:

select empid,
 CASE
  when sal1 > sal2 and sql1 > sal3 ... and sal1 > sal12 then sal1
  when sal2 > sal1 and ... then sal2
  ...
 END
from emptable
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