View previous topic :: View next topic |
Author |
Message |
brijesh_mca1 Beginner
Joined: 21 Nov 2005 Posts: 19 Topics: 10 Location: India
|
Posted: Fri Apr 11, 2008 3:50 am Post subject: Maximum Salary amount |
|
|
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 |
|
|
videlord Beginner
Joined: 09 Dec 2004 Posts: 147 Topics: 19
|
Posted: Fri Apr 11, 2008 9:48 am Post subject: |
|
|
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 |
|
|
|
|