here is example:

sqlite> create table tbl1(words text);
sqlite> create table tbl2(words text);
sqlite> insert into tbl2 (words) values ('seaside');

now i wish to insert into tbl1 some word, but if that word exist in tbl2 to
ignore (word should not be inserted)



Dennis Cote wrote:
> 
> vl.pavlov wrote:
>> 
>> i wander how to do this query:
>> 
>> insert into tablename values ('word') 
>> but if does not exist the same word in other table
>> 
> 
> I'm not sure if this is what you are asking, but you can try this:
> 
> insert into tablename
> select :word
> where not exists (select word from other_table where word = :word)
> 
> HTH
> Dennis Cote
> _______________________________________________
> sqlite-users mailing list
> sqlite-users@sqlite.org
> http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users
> 
> 

-- 
View this message in context: 
http://www.nabble.com/newB-question--c%2B%2B-and-sqlite3--how2-check-if-word-exist-in-the-table-tp15758100p16048123.html
Sent from the SQLite mailing list archive at Nabble.com.

_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to