it works fine!

*****************

This is what I thought you wanted. Using your table and column names my
previous suggestion becomes:

   insert into tbl1
   select 'seaside'
   where not exists
     (select words from tbl2 where words = 'seaside')

The subselect will determine if the word is in tbl2 or not. If the word
exists in tbl2, the subselect will return a row, so the where condition
(not exists) on the select will be false, and the word will not be
inserted into table tbl1. If the word doesn't exist in tbl2, the where
condition will be true, and the word will be inserted into table tbl1. 

******************

i wander is there a way to create combination of these 2 query:

tbl1:    word | number
tbl2:    word

insert into tbl1
select 'seaside'
where not exists
(select words from tbl2 where words = 'seaside')

and 

insert or replace into tbl1 values('seaside',coalesce
((select number from tbl1 where word = 'seaside') + 1, 1));

if there is 'seaside' in tbl2 nothing should be done, but if there is not
seaside should be put into tbl1 and counter should increase

i am sorry if i am annoying, i suppose that this question should solve this
prob.. also i shall learn about databases a lot in the future so maybe i
post more questions in future :)


-- 
View this message in context: 
http://www.nabble.com/newB-question--c%2B%2B-and-sqlite3--how2-check-if-word-exist-in-the-table-tp15758100p16118115.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