Contact Us
  
 
 
    SearchSearch   RegisterRegister   Log inLog in 

calculate second highest salary

calculate second highest salary

 
Post new topic   Reply to topic     Forum Index -> DataBase, RDBMS, MySql, Oracle, db2, SQL Server problems
View previous topic :: View next topic  
Author Message
admin
Site Admin


Joined: 24 Aug 2006
Posts: 30

PostPosted: Sat Oct 14, 2006 4:38 pm    Post subject: calculate second highest salary Reply with quote



How to calculate second highest salary through single query in mysql.
I want
Quote:
calculate second highest salary
in my form.
Back to top
View user's profile Send private message Send e-mail
biggee



Joined: 27 Mar 2007
Posts: 2

PostPosted: Tue Mar 27, 2007 6:04 pm    Post subject: second highest salary Reply with quote

simple to calculate highest one then remove highest one from query

Code:

        select * from tableName order by salaryField desc limit 1,1
   



another option to calculate second highest salary

use max in your query
Quote:
SELECT * FROM tableName where salaryField <> (select max(salaryField) from tableName) order by salaryField desc
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DataBase, RDBMS, MySql, Oracle, db2, SQL Server problems All times are GMT
Page 1 of 1

 
Jump to:  
  Quick Post a Reply Topic
     
  Name (required)  
     
  Email Address (will not be published) (required)  
     
  Subject of topic (required)  
     
   
     
   
     
  Advertisement  
     
 
     


  More Links  
 
JSP Introduction
JSP Setup
Simple JSP Example
JSP Variable
Array Declaration in JSP
JSP Forms and User Input
Form Validation
JSP Cookies
JSP Session Object
Loop, content collection, iterator, conditional check in JSP
JSP Application Object
JSP Include
JSP Response Object
JSP Request Object
JSP Error Handling
JSP File Handling Object
JSP Action Tag
JSP Implicit Objects
JSP Declaration
JSP Directive
JDBC Introduction
JDBC Driver
JDBC Connection
JDBC Prepared/Statement
JDBC ResultSet
JDBC Close Connection object
JDBC Insert
JDBC Display Records
JDBC Update
JDBC Delete
JDBC Sorting
JDBC Query
JDBC Exception
JDBC Add Batch
JDBC Transaction/RollBack