Link to home
Start Free TrialLog in
Avatar of nhay59
nhay59

asked on

overwriting existing table value and auto increment value

Hi,

 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.

Thanks!
ASKER CERTIFIED SOLUTION
Avatar of steelseth12
steelseth12
Flag of Cyprus image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nhay59
nhay59

ASKER

Thanks for the solution. Spot on!