Re: SQL SELECT TOP question

From: chanmmn (chanmmn_at_hotmail.com)
Date: 01/25/05


Date: Wed, 26 Jan 2005 00:52:02 +0800

TOP n [PERCENT]

Specifies that only the first n rows are to be output from the query result
set. n is an integer between 0 and 4294967295. If PERCENT is also specified,
only the first n percent of the rows are output from the result set. When
specified with PERCENT, n must be an integer between 0 and 100.

If the query includes an ORDER BY clause, the first n rows (or n percent of
rows) ordered by the ORDER BY clause are output. If the query has no ORDER
BY clause, the order of the rows is arbitrary.

chanmm
"Brad" <ballison@ukcdogs.com> wrote in message
news:%23WDApjvAFHA.2016@TK2MSFTNGP15.phx.gbl...
>I need to select the Top 50 records from a table of over 10,000 records and
>all is working just fine, but I have a what if question.
>
> What if the 50th record's value matches the 51st record (and possible the
> 52nd and so on)? Does the Select Command also include those records or
> no? If not, how is the 50th record determined?
>
> Thanks for the information.
>
> Brad
>
>
>



Relevant Pages

  • RE: Any good T-SQL quick reference recommended?
    ... The full syntax of the SELECT ... SELECT Clause ... Specifies the columns to be returned by the query. ... Specifies that duplicate rows can appear in the result set. ...
    (microsoft.public.sqlserver.programming)
  • Return Hierarchical Data From One Table (with a JOIN to a second table)
    ... I would appreciate help in designing an efficient query that will retrieve ... [SequenceInRank] ... - specifies which row is the logical parent of the ...
    (microsoft.public.sqlserver.programming)
  • Re: top n problem
    ... >to be output from the query result set. ... >ordered by the ORDER BY clause are output. ... >Specifies that additional rows be returned ... does not mean UNION without ALL is undefined. ...
    (microsoft.public.sqlserver.programming)
  • Re: problem with IWbemService.ExecNotificationQuery()
    ... > Notification or Asyn.Notification query. ... > specifies a class that does not exist. ... > requests more information than Windows Management can reasonably provide. ... > an event query results in a request to poll all objects in a namespace. ...
    (microsoft.public.win32.programmer.wmi)
  • Re: SELECT TOP
    ... percentage of rows in the query result. ... You must include an ORDER BY clause ... The ORDER BY clause specifies the columns ... Therefore, if you specify 10 for nExpr, the query result can contain more ...
    (microsoft.public.fox.programmer.exchange)

Loading