1. Registered User
Join Date
Jun 2004
Posts
57

My small number of brain cells prohibits me from figuring this out. I've got a table

ProviderName EOPCode TotalDenied
Memorial Hosp 66 \$4,598
Memorial Hosp A3 \$2,133
Memorial Hosp 22 \$1,111
Memorial Hosp 20 \$912
Memorial Hosp 39 \$4,321
Memorial Hosp b2 \$62
Parkdate Hosp b2 \$6,251
Parkdate Hosp 66 \$2,346
Parkdate Hosp 22 \$1,252
Parkdate Hosp 20 \$4,056
Stone Hosp V33 \$8,059

I need to output this table as below (with a denial rank for each hospital -- DESC sort on TotalDenied).
I'm stuck on how to get the DenialRank column to work.

ProviderName EOPCode TotalDenied DenialRank
Memorial Hosp 66 \$4,598 1
Memorial Hosp 39 \$4,321 2
Memorial Hosp A3 \$2,133 3
Memorial Hosp 22 \$1,111 4
Memorial Hosp 20 \$912 5
Memorial Hosp b2 \$62 6
Parkdate Hosp b2 \$6,251 1
Parkdate Hosp 20 \$4,056 2
Parkdate Hosp 66 \$2,346 3
Parkdate Hosp 22 \$1,252 4
Stone Hosp V33 \$8,059 1

Appreciate the help.

Ray

2. World Class Flame Warrior
Join Date
Jun 2003
Location
Ohio
Posts
12,595
Code:
```Select	YourTable.ProviderName,
YourTable.EOPCode,
YourTable.TotalDenied,
count(*) as Rank
from	YourTable
inner join
YourTable RankTable
on YourTable.Providername = RankTable.ProviderName
and YourTable.TotalDenied <= RankTable.TotalDenied```

3. Registered User
Join Date
Jun 2004
Posts
57

## Ranking part ii

Order Counter.

This is a relatively simple sql question. I am trying to add an order counter to a db. A given customer might have 10 orders.

The table now simply has all the orders for that customer (and all the other customer orders).

I am hoping to add a column that for customer A adds an OrderNumber (there is no ranking -- just a count). Then it spools to the next customer and starts over at OrderNumber = 1.

Appreciate the help.

Regards

Ray

4. World Class Flame Warrior
Join Date
Jun 2003
Location
Ohio
Posts
12,595
Why are you dredging up a thread that is nearly two years old?

5. Registered User
Join Date
Jun 2004
Posts
57
Blindman.
I had a similar post to the previous one, and I didn't want you to think i was asking the same question twice -- and didn't pay attention to your earlier post.

Ray

6. World Class Flame Warrior
Join Date
Jun 2003
Location
Ohio
Posts
12,595