T
T
theSever2018-07-07 23:23:17
SQL
theSever, 2018-07-07 23:23:17

Compare two columns?

Is it possible to compare data in two columns?
That is, we have two tables ( tbl1 and tbl2 ), each of them has a name column .
In tbl1 name = vasy, pety, kira, and in tbl2 name = kira

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2018-07-07
@Casufi

Googled query examples with NOT IN
https://www.sqlite.org/lang_expr.html
The IN and NOT IN operators take an expression on the left and a list of values ​​or a subquery on the right. When the right operand of an IN or NOT IN operator is a subquery, the subquery must have the same number of columns as there are columns in the row value of the left operand. The subquery on the right of an IN or N

N
nozzy, 2018-07-08
@nozzy

Use not in
or join:

select
t1.name
form tbl1 t1
left join tbl2 t2 on t2.name = t1.name
where t2.name is null

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question