informix支持union all语句吗?

akinggom 2003-08-18 06:51:53
在informix中有没有类似于oracle中的union all语句呢?
在informix中可以用select语句嵌套吗?
可以的话,怎么用呢?最好能给出一个例子来
如:
select id,sum1,sum2 from
(select id ,sum(size1) sum1 from a where where_sql_a
group by id
order by id) a,
(select id, sum(size2) sum2 from a where where_sql_b
group by id
order by id) b
where a.id=b.id
在informix中,我好象怎么也执行不过去,为什么呢?!
...全文
430 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
akinggom 2003-08-21
  • 打赏
  • 举报
回复
谢谢
可惜我写了几次都没有成功
最后,放弃!
用了session保存temp表,然后在查询咯!
虽然失去了时间和空间上的效率,但是能实现我所需要的功能,还是可以的!
谢谢!
wenlq 2003-08-19
  • 打赏
  • 举报
回复
可以的,存储过程的返回处 写上with resume
就可以返回结果集。
akinggom 2003-08-19
  • 打赏
  • 举报
回复
那我在程序中要随时建立临时表咯。
也就是说,要在程序中实现这个问题还需要5个语句来实现咯
drop table a;
drop table b;

select id ,sum(size1) sum1 from a where where_sql_a
group by id
order by id
into temp a;

select id, sum(size2) sum2 from a where where_sql_b
group by id
order by id
into temp b ;

select id,sum1,sum2 from a , b
where a.id = b.id ;
这样才能比较好的得到我想要的数据,是吗?!
那如果我写成procedure的话,informix可以返回成一个记录集吗?!
wenlq 2003-08-19
  • 打赏
  • 举报
回复
select id ,sum(size1) sum1 from a where where_sql_a
group by id
order by id
into temp a;

select id, sum(size2) sum2 from a where where_sql_b
group by id
order by id
into temp b ;

select id,sum1,sum2 from a , b
where a.id = b.id

1,194

社区成员

发帖
与我相关
我的任务
社区描述
其他数据库开发 Informix
社区管理员
  • Informix社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧