<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: SQL SERVER &#8211; 2005 &#8211; Find Nth Highest Record from Database Table</title>
	<atom:link href="http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/</link>
	<description>Personal Notes of Pinal Dave</description>
	<lastBuildDate>Sun, 12 Feb 2012 09:22:39 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Deepak A. Patil</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-208624</link>
		<dc:creator><![CDATA[Deepak A. Patil]]></dc:creator>
		<pubDate>Thu, 01 Dec 2011 12:01:47 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-208624</guid>
		<description><![CDATA[I want to have strictly only Five Records as output of Employees out of 100 or (out of n no of records) with highest salary arranged in asc or dsec order 
with out using Top()]]></description>
		<content:encoded><![CDATA[<p>I want to have strictly only Five Records as output of Employees out of 100 or (out of n no of records) with highest salary arranged in asc or dsec order<br />
with out using Top()</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-191500</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 09 Nov 2011 10:08:19 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-191500</guid>
		<description><![CDATA[Just use substring(col,3,len(col))*1 in place of col in the above query]]></description>
		<content:encoded><![CDATA[<p>Just use substring(col,3,len(col))*1 in place of col in the above query</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-191499</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 09 Nov 2011 10:07:10 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-191499</guid>
		<description><![CDATA[Refer this post
http://beyondrelational.com/ask/madhivanan/questions/784/find-nth-maximum-value.aspx]]></description>
		<content:encoded><![CDATA[<p>Refer this post<br />
<a href="http://beyondrelational.com/ask/madhivanan/questions/784/find-nth-maximum-value.aspx" rel="nofollow">http://beyondrelational.com/ask/madhivanan/questions/784/find-nth-maximum-value.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-191498</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Wed, 09 Nov 2011 10:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-191498</guid>
		<description><![CDATA[Refer these methods
http://beyondrelational.com/ask/madhivanan/questions/784/find-nth-maximum-value.aspx]]></description>
		<content:encoded><![CDATA[<p>Refer these methods<br />
<a href="http://beyondrelational.com/ask/madhivanan/questions/784/find-nth-maximum-value.aspx" rel="nofollow">http://beyondrelational.com/ask/madhivanan/questions/784/find-nth-maximum-value.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jey</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-190623</link>
		<dc:creator><![CDATA[Jey]]></dc:creator>
		<pubDate>Tue, 08 Nov 2011 06:30:45 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-190623</guid>
		<description><![CDATA[can any one explain the query to find the N th max value]]></description>
		<content:encoded><![CDATA[<p>can any one explain the query to find the N th max value</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tariquehassan hassan</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-144117</link>
		<dc:creator><![CDATA[tariquehassan hassan]]></dc:creator>
		<pubDate>Mon, 27 Jun 2011 06:35:13 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-144117</guid>
		<description><![CDATA[Try This...

SELECT     TOP (1) PERCENT A.hist_dt, A.acc_type_cd, A.acc_no, A.current_balance, B.hist_dt AS Expr1
FROM         ecslcall.dbo.investor_nav_hist AS A INNER JOIN
                          (SELECT     hist_dt, acc_type_cd, acc_no, current_balance, div_income, deposit
                            FROM          ecslcall.dbo.investor_nav_hist) AS B ON A.acc_no = B.acc_no AND A.hist_dt &lt; B.hist_dt
WHERE     (A.acc_no = 308) AND (B.hist_dt = CONVERT(DATETIME, &#039;2011-05-22 00:00:00&#039;, 102))
ORDER BY A.hist_dt DESC]]></description>
		<content:encoded><![CDATA[<p>Try This&#8230;</p>
<p>SELECT     TOP (1) PERCENT A.hist_dt, A.acc_type_cd, A.acc_no, A.current_balance, B.hist_dt AS Expr1<br />
FROM         ecslcall.dbo.investor_nav_hist AS A INNER JOIN<br />
                          (SELECT     hist_dt, acc_type_cd, acc_no, current_balance, div_income, deposit<br />
                            FROM          ecslcall.dbo.investor_nav_hist) AS B ON A.acc_no = B.acc_no AND A.hist_dt &lt; B.hist_dt<br />
WHERE     (A.acc_no = 308) AND (B.hist_dt = CONVERT(DATETIME, &#039;2011-05-22 00:00:00&#039;, 102))<br />
ORDER BY A.hist_dt DESC</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tariquehassan hassan</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-144115</link>
		<dc:creator><![CDATA[tariquehassan hassan]]></dc:creator>
		<pubDate>Mon, 27 Jun 2011 06:34:23 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-144115</guid>
		<description><![CDATA[SELECT     TOP (100) PERCENT A.hist_dt, A.acc_type_cd, A.acc_no, A.current_balance, B.hist_dt AS Expr1
FROM         ecslcall.dbo.investor_nav_hist AS A INNER JOIN
                          (SELECT     hist_dt, acc_type_cd, acc_no, current_balance, div_income, deposit
                            FROM          ecslcall.dbo.investor_nav_hist) AS B ON A.acc_no = B.acc_no AND A.hist_dt &lt; B.hist_dt
WHERE     (A.acc_no = 308) AND (B.hist_dt = CONVERT(DATETIME, &#039;2011-05-22 00:00:00&#039;, 102))
ORDER BY A.hist_dt DESC]]></description>
		<content:encoded><![CDATA[<p>SELECT     TOP (100) PERCENT A.hist_dt, A.acc_type_cd, A.acc_no, A.current_balance, B.hist_dt AS Expr1<br />
FROM         ecslcall.dbo.investor_nav_hist AS A INNER JOIN<br />
                          (SELECT     hist_dt, acc_type_cd, acc_no, current_balance, div_income, deposit<br />
                            FROM          ecslcall.dbo.investor_nav_hist) AS B ON A.acc_no = B.acc_no AND A.hist_dt &lt; B.hist_dt<br />
WHERE     (A.acc_no = 308) AND (B.hist_dt = CONVERT(DATETIME, &#039;2011-05-22 00:00:00&#039;, 102))<br />
ORDER BY A.hist_dt DESC</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-124348</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Tue, 22 Mar 2011 06:57:09 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-124348</guid>
		<description><![CDATA[TOP without order by clause is meaningless]]></description>
		<content:encoded><![CDATA[<p>TOP without order by clause is meaningless</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: oattao</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-124336</link>
		<dc:creator><![CDATA[oattao]]></dc:creator>
		<pubDate>Tue, 22 Mar 2011 04:11:50 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-124336</guid>
		<description><![CDATA[I think you can use this:
Select Top N * From yourTable

N: the number of records you want to get]]></description>
		<content:encoded><![CDATA[<p>I think you can use this:<br />
Select Top N * From yourTable</p>
<p>N: the number of records you want to get</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: madhivanan</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-123771</link>
		<dc:creator><![CDATA[madhivanan]]></dc:creator>
		<pubDate>Fri, 18 Mar 2011 08:47:37 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-123771</guid>
		<description><![CDATA[The subquery assign serial no based on the descending order of the salary and if the serial no is 5, it means it is the 5th maximum salary]]></description>
		<content:encoded><![CDATA[<p>The subquery assign serial no based on the descending order of the salary and if the serial no is 5, it means it is the 5th maximum salary</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: S SaravanaKumar</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-123738</link>
		<dc:creator><![CDATA[S SaravanaKumar]]></dc:creator>
		<pubDate>Fri, 18 Mar 2011 04:43:48 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-123738</guid>
		<description><![CDATA[Pinal dave, i have Nth highest salary query, kindly explain how its working
DECLARE @N INT = 1
SELECT * FROM EmployeeDetail  A WHERE (@N = (SELECT COUNT( DISTINCT(B.Salary))
FROM EmployeeDetail B WHERE B.Salary &gt;= A.Salary))]]></description>
		<content:encoded><![CDATA[<p>Pinal dave, i have Nth highest salary query, kindly explain how its working<br />
DECLARE @N INT = 1<br />
SELECT * FROM EmployeeDetail  A WHERE (@N = (SELECT COUNT( DISTINCT(B.Salary))<br />
FROM EmployeeDetail B WHERE B.Salary &gt;= A.Salary))</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sandeep Kumar</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-123671</link>
		<dc:creator><![CDATA[Sandeep Kumar]]></dc:creator>
		<pubDate>Thu, 17 Mar 2011 19:24:11 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-123671</guid>
		<description><![CDATA[Hi All,

Request you to all please find below mentioned query, if i am wrong then feel free to let me know... while i have tried this query and it&#039;s giving rite output....

it will show sixth highest salary...

SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM Table ORDER BY salary DESC) a ORDER BY salary]]></description>
		<content:encoded><![CDATA[<p>Hi All,</p>
<p>Request you to all please find below mentioned query, if i am wrong then feel free to let me know&#8230; while i have tried this query and it&#8217;s giving rite output&#8230;.</p>
<p>it will show sixth highest salary&#8230;</p>
<p>SELECT TOP 1 salary FROM (SELECT DISTINCT TOP 6 salary FROM Table ORDER BY salary DESC) a ORDER BY salary</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajat</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-86844</link>
		<dc:creator><![CDATA[Rajat]]></dc:creator>
		<pubDate>Tue, 07 Sep 2010 06:45:52 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-86844</guid>
		<description><![CDATA[Hi,
How can i get second highest and second lowest salary in a single query..]]></description>
		<content:encoded><![CDATA[<p>Hi,<br />
How can i get second highest and second lowest salary in a single query..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ashish Gilhotra</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-60376</link>
		<dc:creator><![CDATA[Ashish Gilhotra]]></dc:creator>
		<pubDate>Fri, 29 Jan 2010 12:25:49 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-60376</guid>
		<description><![CDATA[@murugaveni.K

Here we go

DECLARE @string varchar(500)
DECLARE @Xml XML
SET @string=&#039;BIS001,BIS002,BIS009,BIS010,BIS003&#039;
SET @xml =    &#039;
                    &#039; + REPLACE(@string, &#039;,&#039;, &#039;&#039;) + &#039;&#039; +
                &#039;&#039;
SELECT top 1 x.v.value(&#039;.&#039;,&#039;VARCHAR(100)&#039;)
FROM @xml.nodes(&#039;/IDs/ID&#039;) x(v)
order by x.v.value(&#039;.&#039;,&#039;VARCHAR(100)&#039;) desc]]></description>
		<content:encoded><![CDATA[<p>@murugaveni.K</p>
<p>Here we go</p>
<p>DECLARE @string varchar(500)<br />
DECLARE @Xml XML<br />
SET @string=&#8217;BIS001,BIS002,BIS009,BIS010,BIS003&#8242;<br />
SET @xml =    &#8216;<br />
                    &#8216; + REPLACE(@string, &#8216;,&#8217;, &#8221;) + &#8221; +<br />
                &#8221;<br />
SELECT top 1 x.v.value(&#8216;.&#8217;,'VARCHAR(100)&#8217;)<br />
FROM @xml.nodes(&#8216;/IDs/ID&#8217;) x(v)<br />
order by x.v.value(&#8216;.&#8217;,'VARCHAR(100)&#8217;) desc</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Murugaveni.K</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-60362</link>
		<dc:creator><![CDATA[Murugaveni.K]]></dc:creator>
		<pubDate>Fri, 29 Jan 2010 06:34:25 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-60362</guid>
		<description><![CDATA[Please send how to code to find the highest record from a field while the number is added with any string.
for example &quot;BIS001,BIS002,BIS009,BIS010,BIS003&quot;...i need ans hear is BIS010]]></description>
		<content:encoded><![CDATA[<p>Please send how to code to find the highest record from a field while the number is added with any string.<br />
for example &#8220;BIS001,BIS002,BIS009,BIS010,BIS003&#8243;&#8230;i need ans hear is BIS010</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ravi</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-60164</link>
		<dc:creator><![CDATA[Ravi]]></dc:creator>
		<pubDate>Sun, 24 Jan 2010 15:09:03 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-60164</guid>
		<description><![CDATA[Hi Nicholas,
if we have duplicate records, will we get the correct record for nth max?

-Ravi]]></description>
		<content:encoded><![CDATA[<p>Hi Nicholas,<br />
if we have duplicate records, will we get the correct record for nth max?</p>
<p>-Ravi</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rahul Bhargava</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-59054</link>
		<dc:creator><![CDATA[Rahul Bhargava]]></dc:creator>
		<pubDate>Mon, 28 Dec 2009 10:47:48 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-59054</guid>
		<description><![CDATA[Hi Pinal,

I would like to know how this query is executes .i am unable to understand how this query is joining E1 , E2 .
as i knows first inner query will be fired but it will not have any info about E1 because it is in outer query.
I will prefer 
SELECT *
FROM HumanResources.EmployeePayHistory E1
WHERE (4-1) = (SELECT COUNT(DISTINCT(E2.Rate))
FROM HumanResources.EmployeePayHistory E2
WHERE E2.Rate &gt; E1.Rate)

this query to get n th record because it is less depent on DB functions it is using general function .]]></description>
		<content:encoded><![CDATA[<p>Hi Pinal,</p>
<p>I would like to know how this query is executes .i am unable to understand how this query is joining E1 , E2 .<br />
as i knows first inner query will be fired but it will not have any info about E1 because it is in outer query.<br />
I will prefer<br />
SELECT *<br />
FROM HumanResources.EmployeePayHistory E1<br />
WHERE (4-1) = (SELECT COUNT(DISTINCT(E2.Rate))<br />
FROM HumanResources.EmployeePayHistory E2<br />
WHERE E2.Rate &gt; E1.Rate)</p>
<p>this query to get n th record because it is less depent on DB functions it is using general function .</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tips</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-57861</link>
		<dc:creator><![CDATA[Tips]]></dc:creator>
		<pubDate>Tue, 24 Nov 2009 13:07:57 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-57861</guid>
		<description><![CDATA[Hi Vidyullatha,

Use this
SELECT * FROM Employee e1 WHERE (N-1) = (SELECT COUNT(DISTINCT(p2.salary))
FROM Employee e2 WHERE e2.salary &gt; e1.salary)]]></description>
		<content:encoded><![CDATA[<p>Hi Vidyullatha,</p>
<p>Use this<br />
SELECT * FROM Employee e1 WHERE (N-1) = (SELECT COUNT(DISTINCT(p2.salary))<br />
FROM Employee e2 WHERE e2.salary &gt; e1.salary)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SQL SERVER - Find Nth Highest Salary of Employee - Query to Retrieve the Nth Maximum value Journey to SQL Authority with Pinal Dave</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-47345</link>
		<dc:creator><![CDATA[SQL SERVER - Find Nth Highest Salary of Employee - Query to Retrieve the Nth Maximum value Journey to SQL Authority with Pinal Dave]]></dc:creator>
		<pubDate>Wed, 25 Feb 2009 10:02:01 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-47345</guid>
		<description><![CDATA[[...] I have re-wrote the same article here with example of SQL Server 2005 Database AdventureWorks : SQL SERVER - 2005 - Find Nth Highest Record from Database ... [...]]]></description>
		<content:encoded><![CDATA[<p>[...] I have re-wrote the same article here with example of SQL Server 2005 Database AdventureWorks : SQL SERVER &#8211; 2005 &#8211; Find Nth Highest Record from Database &#8230; [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vidyullatha</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-44940</link>
		<dc:creator><![CDATA[vidyullatha]]></dc:creator>
		<pubDate>Fri, 19 Dec 2008 15:32:18 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-44940</guid>
		<description><![CDATA[hi ,
this is vidyullatha. i have a dought in sql how to get the nth highest salary from emp table.can i get using sql plz tell me the answer.]]></description>
		<content:encoded><![CDATA[<p>hi ,<br />
this is vidyullatha. i have a dought in sql how to get the nth highest salary from emp table.can i get using sql plz tell me the answer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Faith</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-44232</link>
		<dc:creator><![CDATA[Faith]]></dc:creator>
		<pubDate>Fri, 14 Nov 2008 22:39:51 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-44232</guid>
		<description><![CDATA[hi Vishwanath,

can you try this, where i&#039;m trying to find the third highest salary

select top 1 *
from (select top 3 *
          from emp_table
          order by  salary desc)
order by salary]]></description>
		<content:encoded><![CDATA[<p>hi Vishwanath,</p>
<p>can you try this, where i&#8217;m trying to find the third highest salary</p>
<p>select top 1 *<br />
from (select top 3 *<br />
          from emp_table<br />
          order by  salary desc)<br />
order by salary</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishwanath</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-43408</link>
		<dc:creator><![CDATA[Vishwanath]]></dc:creator>
		<pubDate>Tue, 30 Sep 2008 15:58:56 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-43408</guid>
		<description><![CDATA[Hi nagesh,

Thank you for trying this. Can u pls help me out if their is any other query, as the result is not as expected.

This is not what i need.

Suppose i have a table with following data

EmpNo     Empname    sal

1             X                   100

2             y                    300

3             a                    50

4             b                   200

5             c                    500

6             d                    250



Here i want 3rd record i.e 3    a    50, using the sal column.

If i use ur query i will get  4    b     200  or if the order is changed u may get  6    d     250.
In which the result was not as i expected.
I just want the nth record it may or may not have duplicates]]></description>
		<content:encoded><![CDATA[<p>Hi nagesh,</p>
<p>Thank you for trying this. Can u pls help me out if their is any other query, as the result is not as expected.</p>
<p>This is not what i need.</p>
<p>Suppose i have a table with following data</p>
<p>EmpNo     Empname    sal</p>
<p>1             X                   100</p>
<p>2             y                    300</p>
<p>3             a                    50</p>
<p>4             b                   200</p>
<p>5             c                    500</p>
<p>6             d                    250</p>
<p>Here i want 3rd record i.e 3    a    50, using the sal column.</p>
<p>If i use ur query i will get  4    b     200  or if the order is changed u may get  6    d     250.<br />
In which the result was not as i expected.<br />
I just want the nth record it may or may not have duplicates</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nagesh</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-43223</link>
		<dc:creator><![CDATA[Nagesh]]></dc:creator>
		<pubDate>Wed, 24 Sep 2008 20:16:22 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-43223</guid>
		<description><![CDATA[Hi alll,

use this query for any record you want to find in the table. 


SELECT TOP A salary FROM (SELECT TOP (n) salary FROM employee ORDER BY salary  DESC)
AS E ORDER BY salary   ASC

top(n) give the total no of records

a desire top value

another way

select t.* from (select row_number() over(order by salary) as row_id, salary from sal)
t where t.row_id = 24

give the which nth record you want]]></description>
		<content:encoded><![CDATA[<p>Hi alll,</p>
<p>use this query for any record you want to find in the table. </p>
<p>SELECT TOP A salary FROM (SELECT TOP (n) salary FROM employee ORDER BY salary  DESC)<br />
AS E ORDER BY salary   ASC</p>
<p>top(n) give the total no of records</p>
<p>a desire top value</p>
<p>another way</p>
<p>select t.* from (select row_number() over(order by salary) as row_id, salary from sal)<br />
t where t.row_id = 24</p>
<p>give the which nth record you want</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishwanath</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-42532</link>
		<dc:creator><![CDATA[Vishwanath]]></dc:creator>
		<pubDate>Mon, 08 Sep 2008 09:17:38 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-42532</guid>
		<description><![CDATA[Hi all,
i need to write a Query to find the nth record from a table. Please can any help me out?]]></description>
		<content:encoded><![CDATA[<p>Hi all,<br />
i need to write a Query to find the nth record from a table. Please can any help me out?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishwanath</title>
		<link>http://blog.sqlauthority.com/2008/03/08/sql-server-2005-find-nth-highest-record-from-database-table/#comment-42524</link>
		<dc:creator><![CDATA[Vishwanath]]></dc:creator>
		<pubDate>Mon, 08 Sep 2008 05:59:50 +0000</pubDate>
		<guid isPermaLink="false">http://sqlauthority.wordpress.com/?p=530#comment-42524</guid>
		<description><![CDATA[How to get nth record(its not highest or lowest)  from a table. I am working on SQL SERVER 2005.]]></description>
		<content:encoded><![CDATA[<p>How to get nth record(its not highest or lowest)  from a table. I am working on SQL SERVER 2005.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

