20/10=2 then:select top 2 * from table where color='color1' order by newid()
union all
select top 2 * from table where color='color2' order by newid()
union all
..........select top 2 * from table where color='color10' order by newid()
union all
select top 2 * from table where color='color2' order by newid()
union all
..........select top 2 * from table where color='color10' order by newid()
select top 0 * into #t from table
insert #t select top 2 * from table where color='color1' order by newid()
insert #t select top 2 * from table where color='color2' order by newid()
........
insert #t select top 2 * from table where color='color10' order by newid()select * from #t
union all
select * from (select top 2 * from table1 where color='color2' order by newid())a
union all
..........select * from (select top 2 * from table where color='color10' order by newid())a
select * from (select top 2 * from table1 where color='color1' order by newid()) a
union all
select * from (select top 2 * from table1 where color='color2' order by newid())a
union all
..........select * from (select top 2 * from table where color='color10' order by newid())a3:不要搞得太平均了。
select * from (select top 4 * from table1 where color IN ('color1','color2') order by newid()) a
union all
select * from (select top 4 * from table1 where color in ('color3','color4') order by newid())a
union all
..........select * from (select top 4 * from table where color in ('color9','color10') order by newid())a
select @sql='',@i=0
while @i<10
select @sql=@sql+'
union all select top '+cast(cast(rand()*3 as int)+1 as varchar)
+' * from 表 where color =''color'+cast(@i as varchar)+''' order by newid()'
,@i=@i+1
set @sql=substring(@sql,16,8000)
exec('select top 20 * from('+ @sql+') a')