sql - Always overwrite if exists? -


my table looks like:

_id, subid, textinput, attribute1, attribute2 

when create new record, saves 5 rows... same subid. if create record same subid, saves 5 rows, giving me total of 10 rows subid.

what if subid exists overwrite rows there. how go doing that?

you can use insert or replace, you'll have put unique index on subid.

alternatively, can query table subid , if found, use simple update instead. if not found, use standard insert.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -