ASP.NET MSSQL Select top N values but skip M results

Posted by Mikey on Stack Overflow See other posts from Stack Overflow or by Mikey
Published on 2010-04-07T21:11:57Z Indexed on 2010/04/08 4:23 UTC
Read the original article Hit count: 298

Filed under:
|
|

Im working on an ASP.Net project to display information on a website from a database. I want to select the top 10 items from a news table but skip the first Item and I'm having some problem with it.

<asp:SqlDataSource ID="SqlDataSource1" 
                   runat="server" ProviderName="System.Data.SqlClient"
                   ConnectionString="<%$ ConnectionStrings:ClubSiteDB %>" 
                   SelectCommand="SELECT top 5 [id], 
                                               [itemdate], 
                                               [title], 
                                               [description], 
                                               [photo] 
                                  FROM [Announcements] order by itemdate desc">
</asp:SqlDataSource>

This is what I have so far but i can't find any info online about how to skip a record

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sql