Manning's Countdown to 2014
. Use discount code crdotd14 all month for 50% off every deal.
A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Get Maximum sal from emp table
Joined: Jul 15, 2006
Aug 04, 2006 04:15:00
How to get second maximum sal from emp table... for example
from this table i want to get the second maximum sal example data : 50 6000, can you reply anybody...
Thanks in Advance
Joined: Mar 02, 2006
Aug 04, 2006 04:39:00
order by salary and take the second record (or to be exact cycle through the results after the order by and take the second unique value, in order to avoid the first value appearing multiple times).
Joined: Jul 10, 2004
Aug 09, 2006 08:47:00
select max(sal) from emp a where 2=(select count(distinct(sal)) from emp b
It is sorta covered in the
JavaRanch Style Guide
subject: Get Maximum sal from emp table
SQL query help
inner / sub / inline query
How to get top 3 earners in emp table of SCOTT's schema using SQL
find second largest value in a column
second highest value
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2013