How to get the row number where its ID is 'n' and rows are ordered by some column? I'm trying to get the row number, knowing the row ID, smomething like this:

Get the row number (position) from Table1 order by Col1, where this row ID is 263

 ID |     Col0 |  v Col1 |    Col2
----|----------|---------|---------
258 |        R |       a |       7
262 |        A |       a |       8
277 |        C |       a |      29
263 |        R |       a |      30
202 |        A |       b |      13
219 |        D |       b |      14
  4 |        A |       c |      15
220 |        G |       e |      16
278 |        B |       e |       7
  9 |        P |       f |      18


Is there any way to achieve this
I imagine you'll probably need a secondary ordering column, as Col1 is not a unique value, however this should get you started.

WITH sampledata AS
(
  SELECT 
    ROW_NUMBER() OVER(ORDER BY Col1) as row_num,
    ID,
    Col0,
    Col1,
    Col2
  FROM Table1
)

SELECT 
  row_num 
FROM sampledata 
WHERE ID = 263;