I have a table called groups ( i fill with this data a treeview )
id type description orden description
-- ---- ----------- ----- -----------
1 1 Aninals 1 Elefant
2 1 Animals 2 Tiger
......
25 1 Animals 25 Horse
26 2 Fish 1 Jaws
27 2 Fish 2
....
Deleting, inserting, i have jumps in the column orden.
1 1 Aninals 1 Elefant
2 1 Animals 3 Tiger
......
25 1 Animals 27 Horse
I need do somehing like this:
//animals
Update grupos set orden = (counter ascendent starting by 1) where type = 1 order by orden
//fish
Update grupos set orden = (counter ascendent starting by 1) where type = 2 order by orden
...
to get the column orden without number jumps.
Can some one help with this sql statement ?
Aucun commentaire:
Enregistrer un commentaire