SQLite Forum

adding record if it doesn't already exist
Login
right now we are first searching for email like this:

**SELECT id FROM table1 WHERE email = 'test@domain.com'**

if this doesn't return an ID then:

**INSERT INTO table1 (email) VALUES ('test@domain.com')**

---

instead of doing two DB calls, how do we add the email using EXISTS ?