比较 SQLite 中的两个表 [英] Comparing two tables in SQLite

查看:29
本文介绍了比较 SQLite 中的两个表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个表,想像这样比较 sqlite 上的行

I have two tables and want to compare rows on sqlite like this

table1           table2
field1           field1

a                   a
b                   d
c                   f
d                   g
e
f
g
h
i

我想产生这样的结果

result_table
field1

b
c
e
h
i

sqlite 中的语法如何?谢谢

How is the syntax in sqlite? Thanks

推荐答案

SELECT DISTINCT Field1
FROM Table1 
WHERE Field1 Not IN 
    (SELECT DISTINCT Field1 FROM Table2)

这篇关于比较 SQLite 中的两个表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆