I have some transactions in database. I need to rank the transaction in a custom order. The transactions are

[![enter image description here](https://i.stack.imgur.com/rG3pj.png)](https://i.stack.imgur.com/rG3pj.png)

Transactions needs to be given rank in descending order of csave column and transactions with same tx number will get the same rank. So i execute below query:

```
SELECT * , DENSE_RANK() over (ORDER BY csave desc, tx) AS rank
FROM noma_d.setu_test.report_result

```

**And the result:**

[![enter image description here](https://i.stack.imgur.com/5Pvqb.png)](https://i.stack.imgur.com/5Pvqb.png)

In the above transactions, for same tx, the value of csave column is same. Let's consider below transactions where for **tx =1**, **csave** values are different.

[![enter image description here](https://i.stack.imgur.com/VfDHl.png)](https://i.stack.imgur.com/VfDHl.png)

Now if i execute the same above query, then the result i got:

[![enter image description here](https://i.stack.imgur.com/SbQ9I.png)](https://i.stack.imgur.com/SbQ9I.png)

Here, one transaction of **tx = 1** has **rank = 2** and another transaction of **tx = 1** has **rank = 5**. But i want to give all the transactions of **tx = 1** to **rank = 2** as one transaction of the **tx = 1** got rank **2** so the rest of the transactions with **tx = 1** will also have to be given rank **2**. 

**The expected output will be like below:**

[![enter image description here](https://i.stack.imgur.com/NNVVR.png)](https://i.stack.imgur.com/NNVVR.png)

***How will i achieve this by modifying my above query?***