Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. limit in mssql

limit in mssql

Scheduled Pinned Locked Moved Database
databasemysqlsql-serverquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Deques
    wrote on last edited by
    #1

    mysql has limit to show limited rows but how what does mssql have? i want to make a paging like code i have stumbled on this code select tag, difference from ( select top 4 * from ( select top 8 * from flexi_pump order by tag asc ) as newtbl order by tag desc ) as newtbl2 order by tag asc it works great, but what if the last page only has one row. this sql query shows the last four, not only the last one. (my table has 9 rows)

    C 1 Reply Last reply
    0
    • D Deques

      mysql has limit to show limited rows but how what does mssql have? i want to make a paging like code i have stumbled on this code select tag, difference from ( select top 4 * from ( select top 8 * from flexi_pump order by tag asc ) as newtbl order by tag desc ) as newtbl2 order by tag asc it works great, but what if the last page only has one row. this sql query shows the last four, not only the last one. (my table has 9 rows)

      C Offline
      C Offline
      Colin Angus Mackay
      wrote on last edited by
      #2

      Here is an article on Paging results in SQL Server[^]


      Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

      D 1 Reply Last reply
      0
      • C Colin Angus Mackay

        Here is an article on Paging results in SQL Server[^]


        Upcoming events: * Glasgow: Introduction to AJAX (2nd May), SQL Server 2005 - XML and XML Query Plans, Mock Objects, SQL Server Reporting Services... Never write for other people. Write for yourself, because you have a passion for it. -- Marc Clifton My website

        D Offline
        D Offline
        Deques
        wrote on last edited by
        #3

        thanks, this is a good article edit: i tried this on a windows mobile and it seems not be working :( -- modified at 5:11 Tuesday 24th April, 2007

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups