34,575
社区成员
发帖
与我相关
我的任务
分享
declare @t table (
id int,url nvarchar(30), Q int)
insert @t select
1, 'http://www.baidu.com', 3
union all select
2, 'http://www.126.com', 1
;with cte as (
select * from @t where Q>=1
union all
select id,url,Q=Q-1 from cte where Q>1
)
select top 1 url from cte order by NEWID()