解决Orcale in超过1000个时出现“”列表中的最大表达式数为 1000”这个异常的问题

来源:互联网 发布:软件开发团队组成 编辑:程序博客网 时间:2024/05/22 07:55

第一种使用方法是

select * from table where id in (1, 2, ..., 1000) or id in(1001, ....., 1999)

第二种

select *
  from table
 where id in (1, 2, .. ., 1000)
union all
select *
  from table
 where id in (1001, .... ., 1999)

第三种

因为前两种查询效率太低

现在先把这 2000 个值写到一个临时表中,直接 in 一个子查询

SQL code
?
1
select from where id in (select id from table )

阅读全文
0 0
原创粉丝点击