您的位置:首页 > 运维架构 > Linux

LINUX FTP安装与配置

2014-03-12 11:04 375 查看
<iframe align="top" marginwidth="0" marginheight="0" src="http://www.zealware.com/csdnblog01.html" frameborder="0" width="728" scrolling="no" height="90"></iframe>
/**==** 2. 随机排序中的newid()问题 **==**/
--测试数据
declare @t table(name char(1),value int)
insert into @t
select 'a',1
union all select 'a',2
union all select 'b',3
union all select 'b',4
union all select 'c',5
union all select 'c',6

--要求,随机排序,但name相同的要排在一齐
select a.*
from @t a join(
select aa=newid(),name from(select distinct name from @t) a
) b on a.name=b.name
order by b.aa,newid()

/*--测试结果之一,并没有达到要求.如果将join改成left right full join,就正确
name value
---- -----------
b 4
b 3
c 5
a 1
a 2
c 6

(所影响的行数为 6 行)
--*/

Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=55108
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: