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

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -