select *
from (select *
from tableA
where type = 'A'
order by dbms_random.value)
where rownum = 1
union all
select *
from (select *
from tableA
where type = 'B'
order by dbms_random.value)
where rownum = 1
union all
select *
from (select *
from tableA
where type = 'C'
order by dbms_random.value)
where rownum = 1
union all
select *
from (select *
from tableA
where type = 'D'
order by dbms_random.value)
where rownum = 1
union all
select *
from (select *
from tableA
where type = 'E'
order by dbms_random.value)
where rownum = 1
本文探讨了SQL中使用聚合查询与随机数生成的方法,通过示例展示了如何从不同类型的表格中抽取特定条件的数据,并对其进行随机排序和选择。

4637

被折叠的 条评论
为什么被折叠?



