sqlite - Assign ID numbers according to groups -
button blue can add blue item, red button adding red button, etc. 1 button can clicked more once, hence there can more 1 blue or red item.
the table below
item id details size blue cheap small blue expensive big blue cheap small red cheap small red ok average
how can assign id each of them table below
item id details size blue 1 cheap small blue 2 expensive big blue 3 cheap small red 1 cheap small red 2 ok average
just largest id item (use 0 if none exists yet), , add one:
select ifnull(max(id), 0) + 1 mytable item = ?;
Comments
Post a Comment