Re: Running counter

From: MichaelK (michaelk_at_gomobile.com)
Date: 12/28/04


Date: Mon, 27 Dec 2004 16:08:54 -0800

Thanks Hugo.
Interesting idea and works, but takes very long.
Unfortunately can't use it, need something faster.

Hey guys any other ideas?

Regards,
Michael

"Hugo Kornelis" <hugo@pe_NO_rFact.in_SPAM_fo> wrote in message
news:q961t0l1ohanli4b68a4j71d4vet8t8j72@4ax.com...
> On Mon, 27 Dec 2004 13:37:05 -0800, MichaelK wrote:
>
>>Is it possible to make a query to have a counter which would have
>>a sequential number of each record in the query starting with 1?
>
> Hi Michael,
>
> That depends. Relational databases handle sets, which are UNordered by
> definition, so there is no such thing as an intrinsic "row number". But if
> you can define something to base the numbering on, you can have SQL Server
> add the numbers.
>
> As an example, the following query will list all authors with a ranking
> based on alphabetic order of last name (note how the tie for Albert Ringer
> and Ann Ringer is handled!):
>
> USE pubs
> GO
> SELECT au_id, au_lname, au_fname,
> (SELECT 1 + COUNT(*)
> FROM authors AS b
> WHERE b.au_lname < a.au_lname) AS rank
> FROM authors AS a
> ORDER BY rank
> GO
>
> Best, Hugo
> --
>
> (Remove _NO_ and _SPAM_ to get my e-mail address)



Relevant Pages

  • Re: Running counter
    ... Relational databases handle sets, which are UNordered by ... the following query will list all authors with a ranking ... based on alphabetic order of last name (note how the tie for Albert Ringer ...
    (microsoft.public.sqlserver.mseq)
  • Re: References choice...
    ... Then you can use it in code, to use it in a query - you need to make a public function, which returns this variable value, and use this function in a query ... Best regards, ... Is it possible to define constant 'A' that would pick a value from combobox ... >> in general - you need to have min 3 references in Access ...
    (microsoft.public.access.modulesdaovba)
  • Re: Webdav htmldescription tag missing from response
    ... Instead of DAV:htmldescriptions, you must query urn:schemas:httpmail:htmldescription ... Best regards, ... the reason why no html description is returned in this case, ... > Webdav and has been quite happy for sometime. ...
    (microsoft.public.exchange.applications)
  • Re: date useage in vb expression
    ... > a WHERE clause rather than a named filter or query. ... >> End Sub ... >> Best regards ... >> Scott B ...
    (microsoft.public.access.formscoding)
  • Re: Query to use like values from other table
    ... or similar to above query. ... Best Regards, ... Luqman ... >> The ways I know is either use union query ...
    (microsoft.public.sqlserver.programming)