sql - Increment field in MySql if duplicate value -
i have table keeps track of ip addresses 3 fields -- id, ip, total.
if i'm inserting duplicate ip value, i'd increment total field 1.
how should this?
you mean counting total ? add 1 if ip
existing ?
declare @total int = (select count(total) tablename) if exist (select ip tablename) begin set @total = @total + 1 end insert into...
Comments
Post a Comment