Hi guys, I have the following table SNo Value Item where Sno is a column which exists in another table also. Right now , what I need is a self incrementing field which will go on incrementing if the value of sno is a constant and then get back to 0 and start incrementing again once the value of sno changes. IS there any way to do this?
I am only vaguely following what you are asking. Are you describing what should happen when you insert anew row into the table? Can you post some sample data and show examples of the conditions under which a value should be icremented and conditions under which it should be 0?
Lets say I have four columns: SNO|Value |Item | AUtoIncrementingField 1___344_____a________0 1___345_____b________1 1___346_____c________2 2___568_____d________0
So when I say insert into this table , and the value of SNO becomes two the value of the auto incrementing field should go back to 0. Is there any inbuilt way of doing this, or writing some code on top of mysql to achieve this. If not what other option do I have to uniquely identify each value/item belonging to a certain value of sno?