Although it is not a good practice you could use a query like this:
Let's assume we have a table with two fiels id
and value
where id
is of type INT.
insert into table (id, value)
select max(id)+1, 'value' from table
Be aware that with a lot of insert/update there could be problems if more than one queries runs simultaneously.