0

Possible Duplicate:
INSERT IF NOT EXISTS ELSE UPDATE?

I want to check if a row (with it's ID) exists in a database, if yes, I want to update the column category, if it does not exist, i want to add a new row. Is this possible via a single query in sqlite (will be applied inside eclipse using java for an android app)

0

1 Answer 1

0

I think that it's not possible. First you have to execute a query to check if a row exist, if yes, execute an update statement, if not, execute an insert statment...i think this are the way to go...

if(existsId(id)){
   updateCategory(categoryValue);
}else{
   addNewRow(newRowData);
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.