请教一个同时包含排序、union、ROWNUM的SQL问题

[复制链接]
查看11 | 回复1 | 2005-10-30 17:05:33 | 显示全部楼层 |阅读模式
我想实现 从多个表中联合查询,并且排序,并且只要20行结果,给如何实现呢?
我是这样实现的:
select * from {
select id,name from tableA order by id asc union
select id,name from tableB order by id asc
} where ROWNUM 复制代码



回复

使用道具 举报

千问 | 2005-10-30 17:05:33 | 显示全部楼层
原帖由 lixuezhen 于 07-12-12 13:06 发表

select * from {
select id,name from tableA
union
select id,name from tableB
order by id asc
} where ROWNUM




回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行