select count(*) as visit_count from visits where id=@MyID
where @MyID is your id
select count(*) as visit_count from visits where id='MyID'
before inserting get this count and run your query
or do something like this while inserting
insert into visits(...) values(id, (select count(*) as visit_count from visits where id='MyID'), ...)