sqlite - SQL: checking if row contains contents of another cell -


i'm having difficulty sql query.

i have 2 tables:

table 1

id/first name 1    ben 2    barry 3    birl 

table 2

id/full name  1     ben rurth 2     barry bird 3     burney saf 

i want run check between 2 tables if contents of first name in table 1 not in full name in table 2 result returned, e.g. returning id 3, birl, in above example.

i have been trying queries like:

select first_name  table_1  not exist (select full_name table_2)  

with no luck far.

you can make use of like clause combined concatenation.

select t1.first_name,t2.full_name table1 t1 join table2 t2 on t1.id = t2.id t2.full_name not '%' || t1.first_name || '%' 

or

select t1.first_name,t2.full_name table1 t1 join table2 t2 on t1.id = t2.id t2.full_name not concat('%', t1.first_name, '%') 

this is, understanding both tables shares id column.


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -