【发布时间】:2022-01-03 18:48:20
【问题描述】:
我有两个 SQL 查询; 第一个是:
with b as (select person_id from people where name='Ward Bond' and born=1903)
select title_id from b natural join crew;
这会产生正确的结果并且可以。 另一个是:
with c as (select person_id from people where name='John Wayne' and born=1907)
select title_id from c natural join crew;
这也完全可以并产生正确的结果。一旦我尝试使用以下查询找到这两个查询的交集:
with b as (select person_id from people where name='Ward Bond' and born=1903) select title_id from b natural join crew
intersect
with c as (select person_id from people where name='John Wayne' and born=1907) select title_id from c natural join crew;
我收到错误Error: near "with": syntax error
我正在使用 SQLite3。你能帮我找出问题吗?我想要得到的东西很简单;我想要这两个临时表的交集。
【问题讨论】:
标签: sqlite select with-statement intersect