There are three fields(_id,name,count) in in a table name poet. I want to check if poet name exist in the table then update count field with increment of 1 or else insert a new record with the given name and count as 1. Here is my query. It is inserting null value for count if there name not found in the table. Although it is working good if I want to update already existing records.
insert or replace into poet (_id,Name, count) values (
(select _id from poet where Name = "SearchName"),
"SearchName",
(select count from poet where Name = "SearchName")+ 1)