Page 1 of 1
Auto incrementing.
Posted: Mon Jun 20, 2011 7:43 pm
by Torniquet
through phpmydamin is there any way to set up a table so that a column will increment accourding to the setting of another column?
so for eg?
column A contains ENUM a,b,c and column B contains INT
column B needs to be auto incremented.
so if there were 4 a's set in A and 2 b's, i inserted another row setting A to be 'b', can i get B to auto increment according to what value would be next for the b's?
make sense? lol.
Re: Auto incrementing.
Posted: Mon Jun 20, 2011 7:49 pm
by jacek
Torniquet wrote:make sense? lol.
Not really
Torniquet wrote:through phpmydamin is there any way to set up a table so that a column will increment accourding to the setting of another column?
No, but can you not make the comparison with php and decide on the value to insert ? Or could you not ge the same data using mysql functions when selecting ?
Re: Auto incrementing.
Posted: Mon Jun 20, 2011 7:57 pm
by Torniquet
well i have a mysql driven dynamic menu system. (there is a reason for it, and it is easier than making it static for its use lol)
The idea is that A would be the menu selector, and B is the items position. so if i am putting in menu items, the position needs to be different. Just thought it might be easier to set phpmyadmin to do it rather than faf about with a script.
I will have to make one earlier than intended now lol.
Re: Auto incrementing.
Posted: Mon Jun 20, 2011 8:02 pm
by jacek
phpmyadmin is just an interface to the mysql server, it cant do anything. There may be some obscure MySQL feature that lets you do this but I don't know of it.