🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: bit.databases.mssql-l
Article #133

Re: Is there a rank function in sql?

#133
From: Dave
Date: Sat, 07 Oct 2000 00:00
24 lines
1363 bytes
Lili:

I think you are going to have to write a function that goes through the data
with a cursor and computes the rank, then returns it for a given record.
Not a trivial task, but offhand I think it is dooable that way.

-Dave

Lingli Kong wrote:

> Hi, experts,
>
> I just picked up ms-sql and got stuck with the following problem:
> I need a funtion that will return the rank of a input values. For an
> example, if the input of x is:
> 1.1 3.8 3.2 4.1
> I need to have y as:
> 1 3 2 4
>
> I checked and found there's no function named 'Rank' in SQL.  Can anyone
> help me on this?
>
> Thanks.
> Lili
Technical Details
Message-ID: <39DE97F0.EA5759AD@pacifier.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <Pine.SGI.4.05.10008300823410.1988-100000@rgmiller.Stanford.EDU>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f6611,605ae611a9ec1240
X-Google-Attributes: gidf6611,public
From: Dave <Raider@pacifier.com>
Subject: Re: Is there a rank function in sql?
Date: 2000/10/07
Message-ID: <39DE97F0.EA5759AD@pacifier.com>
X-Deja-AN: 678536068
Content-Transfer-Encoding: 7bit
References: <Pine.SGI.4.05.10008300823410.1988-100000@rgmiller.Stanford.EDU>
Content-Type: text/plain; charset=us-ascii
X-Complaints-To: abuse@home.net
X-Trace: news1.sttls1.wa.home.com 970889233 65.0.37.28 (Fri, 06 Oct 2000 20:27:13 PDT)
Organization: @Home Network
MIME-Version: 1.0
Reply-To: nospam-raider@pacifier.com
NNTP-Posting-Date: Fri, 06 Oct 2000 20:27:13 PDT
Newsgroups: bit.databases.mssql-l