SQLite User Forum

Restart a counter in a table based on a another field in the same table
Login
```
  select p,
         s, 
         dense_rank() over (order by p), 
         row_number() over (partition by p) 
    from t
order by p, s;
```