overwriting existing table value and auto increment value
Posted on 2007-11-24
I have a very simple table in a mysql database, which has the following columns,
id, tag, and count
The id column value is set to auto increment when I add a new value for tag and count. Instead of creating a new value each time for the column 'tag', is it possible to overwrite an existing value with the same value and then simply increase the value of count by 1.
eg: id =1. tag=world. count=20. If I then added the value 'world' again to the table, I would want to overwrite the previous value of count, and increase it by one to '21' and so on. Therefore, we would end up with a new row of id=1. tag=world, count=21 and so on. I don't mind if the id is changed, as long as the unique value for the tag, ie: 'world', is not replicated in the table.
Any help appreciated.