sql中多个集合的第一条数据合并成一条 5
selectT1.nameast1name,T2.nameast2name,T3.nameast3namefrom(selectnamefrom(selectnamefr...
select T1.name as t1name,
T2.name as t2name,
T3.name as t3name
from
(select name from (select name from view_1 order by date desc)
where rownum =1) T1,
(select name from (select name from view_2 order by date desc)
where rownum =1) T2,
(select name from (select name from view_3 order by date desc)
where rownum =1) T3,
说明:现在这个sql文不对。请教一下怎么改?应该怎么关联?
预想结果:只要有一个结果集有数据就能检索出来。
※三个结果集(T1,T2,T3)都可能是空。
想要的结果:最后合成一条数据输出。
列名:t1name,t2name,t3name
数据:null,t2name,null 展开
T2.name as t2name,
T3.name as t3name
from
(select name from (select name from view_1 order by date desc)
where rownum =1) T1,
(select name from (select name from view_2 order by date desc)
where rownum =1) T2,
(select name from (select name from view_3 order by date desc)
where rownum =1) T3,
说明:现在这个sql文不对。请教一下怎么改?应该怎么关联?
预想结果:只要有一个结果集有数据就能检索出来。
※三个结果集(T1,T2,T3)都可能是空。
想要的结果:最后合成一条数据输出。
列名:t1name,t2name,t3name
数据:null,t2name,null 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询