SQLite Forum

Novice question concerning adding conditional incremental integer counter
Login
If you want this to be able to be run multiple times when the data changes, then use:

```
update x as dst
   set desired_new_index = ni
  from (
        select _rowid_,
               row_number() over (partition by book_no, chapter_no, verse_no order by index_no) as ni
          from x
         where strongs_no != 'punc2'
       union all
        select _rowid_,
               null as ni
         from x
        where strongs_no == 'punc2'
       ) as src
 where src._rowid_ == dst._rowid_
;
```

** No need to sort the update table, so it can use a UNION ALL **