Oracle数据库随机取某条记录的一个字段值
2024-08-24 13:02:54
思路:
先将取出的值随机排序,然后在随机排序的每次取第一条的结果
举例如下:
select * from(select t.code fromTBIZOPS_PROVINCE t ORDER BY DBMS_RANDOM.RANDOM())where rownum < 2;
select * from (select t.code from TBIZOPS_CITY t wheret.province_id = '13' ORDER BY DBMS_RANDOM.RANDOM()) where rownum< 2 ;
select * from (select t.code from TBIZOPS_County t wheret.province_id = '13' and t.city_id = '1304'ORDER BYDBMS_RANDOM.RANDOM()) where rownum < 2 ;
最新文章
- grape动态PHP结构(一)——目录结构与配置文件
- python高级之网络编程
- Python基础知识之认识字符串
- STL-next permutation
- 算法:最大子数组own
- Convolution and Deconvolution
- Java中报错No enclosing instance of type caiquan is accessible. Must qualify the allocation with an enclosing instance of type caiquan (e.g. x.new A() where x is an instance of caiquan).
- Node.js权威指南 (10) - Node.js中的错误处理与断言处理
- #if defined 的意思?
- Ffplay视频播放流程
- Asp.net网站的简单发布
- springmvc图片上传(兼容ie8以上,实时预览)
- 【Docker】Docker概述
- 【Python 07】汇率兑换1.0-2(基本元素)
- mysql 性能监控
- 对负载均衡的理解及nginx负载均衡的配置
- EF框架搭建小总结--CodeFirst代码优先
- CentOS下安装高版本GCC
- SqlServer数据库分离与附加
- PyQt5 应用在 TeamViewer 下无法使用全屏模式