I need to do something similar to replace, but can't figure out how to do it.
Here's my table: user varchar(15) PRI cnt int(11) I want to increment cnt for user if it exists, else insert a row with cnt=1. I tried the following, but mysql complains that I can't use the same table in the update and select: replace into table set user='someuser', cnt=(select cnt+1 from table where user='someuser') Can this be done (in 1 query, of course)? Thanks, Juan E