首頁  >  文章  >  資料庫  >  sql语句巩固

sql语句巩固

WBOY
WBOY原創
2016-06-07 17:44:401064瀏覽

查询每行随机值 if(object_id('tempdb..#cc','U')is not null) drop table #cc go declare @a int set @a=0 while @a15 begin if @a=0 select floor(rand()*3)+3 as cc into #cc else insert into #cc values( floor(rand()*3)+3 ) set @a=@a+1 end select *

查询每行随机值

if(object_id('tempdb..#cc','U')is not null)
drop table #cc
go
declare @a int
set @a=0
while @abegin
if @a=0
select floor(rand()*3)+3 as cc into #cc
else
insert into #cc values( floor(rand()*3)+3 )
set @a=@a+1
end
select * from #cc

 

连接查询

select a.Class_Content,*from T1103.dbo.T101_1
inner join (SELECT Class_Code, Class_Content FROM   WssMng_SXZ.dbo.ClassTable
                    WHERE (Fk_ClassName = '案件来源')) as a on a.Class_Code = T101_1.M101_1_111
where unitID ='130800'

,香港服务器租用,美国空间,香港服务器
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn