sqlite中具有复杂子查询的sql联合查询

sqlite中具有复杂子查询的sql联合查询,sql,sqlite,Sql,Sqlite,我需要合并两个复杂子查询的结果。我有以下在sqlite中工作的查询 select * from (select objectid from osm where tag = 'b' union select objectid from osm where tag = 'a'); 我想将其修改如下(简化): 这在sqlite中无效。所以我想做的是 select

我需要合并两个复杂子查询的结果。我有以下在sqlite中工作的查询

select * from (select 
               objectid from osm where tag = 'b' 
                     union 
               select 
               objectid from osm where tag = 'a');
我想将其修改如下(简化):

这在sqlite中无效。所以我想做的是

select * from 
    (select objectid from osm where tag = 'b' limit 10) as b, 
    (select objectid from osm where tag = 'a' limit 10) as a, 
    osm
where 
    osm.objectid in (a union b);
但这同样是无效的。我知道我能做到

 osm.objectid in a OR osm.objectid in b;

但由于一些技术原因,我不能使用或。没有OR有什么方法可以做到这一点吗?

我认为有一个技巧可以让你随心所欲:

select *
from osm
where objectid in (select objectid from osm where tab = 'b' limit 10) or
      objectid in (select objectid from osm where tab = 'b' limit 10);

限制适用于整个查询,因此您必须使用单独的子查询层才能联合有限的查询:

select * from
  (select * from (select objectid from osm where tag = 'b' limit 10)
   union 
   select * from (select objectid from osm where tag = 'a' limit 10));
select * from
  (select * from (select objectid from osm where tag = 'b' limit 10)
   union 
   select * from (select objectid from osm where tag = 'a' limit 10));