简体   繁体   中英

Select Only 2nd Row From Table

Is there a script I can run to only select the 2nd row of a table?

Here is what I currently have to retrieve results.

SELECT [Acct # (DDMA)]
 ,[Short Name (DDMA)] 
FROM [EWFImport].[dbo].[Page1$] 

Use offset 1 row to skip the first row. Use fetch first 1 row only to get only one row, the 2:nd one.

SELECT [Acct # (DDMA)]
      ,[Short Name (DDMA)] 
FROM [EWFImport].[dbo].[Page1$]
ORDER BY [Acct # (DDMA)]
offset 1 row
fetch first 1 row only

(I chose to ORDER BY [Acct # (DDMA)] here, switch to other column if that suits you better.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM