sql如何进行分层随机抽样

职业培训 培训职业 2025-01-07
--按大、中、小 分别选取 然后再组合--按新字段重新排序后,你选出来的就是随机的了select top 60 percent * from table_1 where A='大' order by Bunion allselect top 60 percent * from table_1 where A='中' order by Bunion allselect top 60 percent *

--按大、中、小 分别选取 然后再组合

--按新字段重新排序后,你选出来的就是随机的了

select top 60 percent * from table_1 where A='大' order by B

union all

select top 60 percent * from table_1 where A='中' order by B

union all

select top 60 percent * from table_1 where A='小' order by B

标签

版权声明:本文由哟品培原创或收集发布,如需转载请注明出处。

本文链接:http://www.yopinpei.com/20250107/2/1281741

猜你喜欢
其他标签