Re: Creating a Rank Value
From: Aaron [SQL Server MVP] (ten.xoc_at_dnartreb.noraa)
Date: 07/03/04
- Next message: Aaron [SQL Server MVP]: "Re: Returning One line for the same trans_no when some columns contain different data"
- Previous message: Linda: "Re: Returning One line for the same trans_no when some columns contain different data"
- In reply to: Aaron W. West: "Re: Creating a Rank Value"
- Next in thread: Aaron W. West: "Re: Creating a Rank Value"
- Reply: Aaron W. West: "Re: Creating a Rank Value"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 3 Jul 2004 15:42:59 -0400
> update table
> set @rank=rank=case
> when @groupvalue <> groupvalue then 1
> when @scoringvalue < scoringvalue then @rank + 1
> else @rank
> end
> , @groupvalue = groupvalue, @scoringvalue = scoringvalue
> from table
Why do you need to store this rank? Do you really want to run this UPDATE
statement every single time the table is updated? Wouldn't it make more
sense to generate the ranks at runtime (since they can be calculated by data
in the table), as opposed to storing them perpetually?
-- http://www.aspfaq.com/ (Reverse address to reply.)
- Next message: Aaron [SQL Server MVP]: "Re: Returning One line for the same trans_no when some columns contain different data"
- Previous message: Linda: "Re: Returning One line for the same trans_no when some columns contain different data"
- In reply to: Aaron W. West: "Re: Creating a Rank Value"
- Next in thread: Aaron W. West: "Re: Creating a Rank Value"
- Reply: Aaron W. West: "Re: Creating a Rank Value"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|