sql如何取交集有这样两条sql语句select distinct id from a where id='123'select distinct id from a where id='456'我希望能把他们取得他们记录的交集,sql语句该如何写?错了 应该是这样的select distinct temid from a whe
来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/18 17:57:20
sql如何取交集有这样两条sql语句select distinct id from a where id='123'select distinct id from a where id='456'我希望能把他们取得他们记录的交集,sql语句该如何写?错了 应该是这样的select distinct temid from a whe
sql如何取交集
有这样两条sql语句
select distinct id from a where id='123'
select distinct id from a where id='456'
我希望能把他们取得他们记录的交集,sql语句该如何写?
错了 应该是这样的
select distinct temid from a where id='123'
select distinct temid from a where id='456
sql如何取交集有这样两条sql语句select distinct id from a where id='123'select distinct id from a where id='456'我希望能把他们取得他们记录的交集,sql语句该如何写?错了 应该是这样的select distinct temid from a whe
select distinct id from a where id='123' and id in (select distinct id from a where id='456')
不过偶实在没看出select distinct id from a where id='123'这种语句有什么用处. 就你写的来说这二者不可能有什么交集.
如果你的意思是指并集,就应该用select distinct id from a where id='456' or id = '123'
select distinct id from a where id='456' and id = '123'
此结果无交集·
我想通过查询与当前新闻具有关键字交集不为空的新闻来实现,可又不知道这.,至于这个怎么组合这个sql,这个我想你应该知道的吧,不知道我有没有理解