Usage of the TOP clause

  • Does your query also have an Order By clause? If not, Top can/will do strange things.

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • SELECT TOP (10) <column list>

    FROM <Some Table>

    ORDER BY <Whatever columns defines the ordering you want>

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (6/6/2011)


    SELECT TOP (10) <column list>

    FROM <Some Table>

    ORDER BY <Whatever columns defines the ordering you want>

    Thanks it has been useful

Viewing 3 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply