September 17, 2008 at 5:14 am
Hi All,
I have a problem in T-Sql , I Want to See Top 3rd Positional Value in a Table not Top Three.
Pls any one help me.
Sanjay Thakur
DBA-Richagroup
+91987325028
September 17, 2008 at 5:20 am
Hi Sanjay
Please have a read of this thread: http://www.sqlservercentral.com/Forums/Topic565091-145-1.aspx
it will help us to help you.
Cheers
ChrisM
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
September 17, 2008 at 5:22 am
try this out,
select top 3 * from YourTable
except
select top 2 * from YourTable
or you can use ROW_NUMBER()
;WITH OrderTable AS
(SELECT *,
ROW_NUMBER() OVER (order by id)as RowNumber
FROM YourTable )
SELECT *
FROM OrderTable
WHERE RowNumber = 3;
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply