query

  • how to retrive last 10 record form emp table?

  • Define 'last'

    If you mean 'most recently entered', then you need some column that shows the order entered. Date inserted or an identity column. Order by that desc and use TOP

    If you mean last 10 ordered by a specific column, then order by that column desc and use TOP

    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
  • select top 10 * from TableName order by ColumnName desc

    This will give you last 10 records when ordered by columnName

    :hehe:

  • if u have autogenerated/ identity EmpID

    select top 10 * from emp order by EmpID desc

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

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