﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2008 / T-SQL (SS2K8)  / T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sun, 19 May 2013 16:26:54 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>[quote][b]Lynn Pettis (1/28/2013)[/b][hr]Hoping this is late enough not to be useful with your interview but soon enough to help you learn something[/quote]Why does this bring to mind the vision of an interviewee tapping away at an iPad during the interview, posting a question to SSC, in the hopes that it will be answered by the time the interviewer blinks twice?</description><pubDate>Tue, 29 Jan 2013 00:47:55 GMT</pubDate><dc:creator>dwain.c</dc:creator></item><item><title>RE: T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>Hoping this is late enough not to be useful with your interview but soon enough to help you learn something:[code="sql"]WITH Salaries AS (SELECT     EmpID,    EmpLastName,    EmpFirstName,    Salary,    rn = ROW_NUMBER() OVER (PARTITION BY EmpID ORDER BY Salary DESC) FROM    dbo.Employee)SELECT    *FROM    SalariesWHERE    rn between 10 and 11;-- or, without windowing functions ala SQL Server 2000:select top 2    *from    (select top 11            EmpID,            EmpLastName,            EmpFirstName,            Salary     from         dbo.Employee     order by         Salary DESC) dtorder by    dt.Salary ASC;[/code]</description><pubDate>Mon, 28 Jan 2013 22:14:45 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>this should work too...declare @t table(empname varchar(32),sal money)insert into @t select 'patrick',1000unionselect 'john',12000unionselect 'peter',500unionselect 'robert',360unionselect 'steve',810unionselect 'edward',3000unionselect 'sean',1200unionselect 'ricky',500select * from(select empname,ROW_NUMBER() over (order by sal desc) as position from @t)a where position between 5 and 6</description><pubDate>Mon, 28 Jan 2013 15:24:16 GMT</pubDate><dc:creator>sqlbi.vvamsi</dc:creator></item><item><title>RE: T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>you can also do it SQL2000 style(before the wonderful row_number/ranking functions came out) , using nested TOP  statements to get the top 11, and then the top 2 of that in the opposite order.</description><pubDate>Mon, 28 Jan 2013 14:00:37 GMT</pubDate><dc:creator>Lowell</dc:creator></item><item><title>RE: T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>You may get an error, misplaced parens and the sort is wrong.</description><pubDate>Mon, 28 Jan 2013 13:58:10 GMT</pubDate><dc:creator>Lynn Pettis</dc:creator></item><item><title>RE: T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>thanks. i will blug in and see if that answers the question </description><pubDate>Mon, 28 Jan 2013 13:49:47 GMT</pubDate><dc:creator>Massan</dc:creator></item><item><title>RE: T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>Using the Rank function would be very helpfull for this., possibly a cte.;WITH Salaries AS (SELECT EmpID,EmpLastName,EmpFirstName,SalaryRANK() OVER (PARTITION BY EmpID, ORDER BY Salary)) FROM dbo.Employee)AS SalaryRankSELECT *FROM SalariesWHERE (SalaryRank = 10    OR SalaryRank=11)</description><pubDate>Mon, 28 Jan 2013 13:37:04 GMT</pubDate><dc:creator>Ray M</dc:creator></item><item><title>RE: T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>How about thinking you need the first 11 but you need to discard the first 9. How do you discard rows? EXCEPT, NOT IN, NOT EXISTS, OUTER JOIN?</description><pubDate>Mon, 28 Jan 2013 13:36:51 GMT</pubDate><dc:creator>Luis Cazares</dc:creator></item><item><title>T-SQL, SELECT 10TH AND 11TH HIGHEST SALARY EMPLOYEES FROM EMPLOYEE TABLE</title><link>http://www.sqlservercentral.com/Forums/Topic1412625-392-1.aspx</link><description>PLEASE HELP ME WHO EVER CAN WRITE MORE EFFICIENT T-SQL THAT ANSWERS THE QUESTION.THIS IS WHEN WE DONT KNOW THE SALARY INFORMATION AND WE ONLY CARE THE  10TH AND 11TH EMPLOYEESITS FROM JOB INTERVIEW, WHICH I SIAD ! I DONT KNOW!</description><pubDate>Mon, 28 Jan 2013 13:26:37 GMT</pubDate><dc:creator>Massan</dc:creator></item></channel></rss>