随机分组条件语句for (1..1000){open AOUT,">a$_.txt" || die "Can't open the file:";open BOUT,">b$_.txt" || die "Can't open the file:";open IN,"
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/06 09:38:54
随机分组条件语句for (1..1000){open AOUT,">a$_.txt" || die "Can't open the file:";open BOUT,">b$_.txt" || die "Can't open the file:";open IN,"
随机分组条件语句
for (1..1000){
open AOUT,">a$_.txt" || die "Can't open the file:";
open BOUT,">b$_.txt" || die "Can't open the file:";
open IN,"
随机分组条件语句for (1..1000){open AOUT,">a$_.txt" || die "Can't open the file:";open BOUT,">b$_.txt" || die "Can't open the file:";open IN,"
新建一个找到第N个字串起始位置的函数charindexN
create function dbo.charindexN (@indexStr varchar(100)='',--要查找的子串
@str varchar(2000)='',--字符串
@n int=null) --从第n个子串开始查
returns int
begin
declare @tmp varchar(2000) --
declare @m int
declare @i int
set @tmp=@str
set @i=1
set @m=0
while charindex(@indexStr,@tmp)>0 and @i<=@n
begin
set @m=@m+charindex(@indexStr,@tmp)
set @tmp=substring(@tmp,@m+len(@indexStr),len(@tmp))
set @i=@i+1
end
if @i-1<>@n set @m=0
return @m
end
select substring(a.xsgg,1,dbo.charindexN('*',a.xsgg,1)-1) xsgg,count(*) num from T1 a
group by substring(a.xsgg,1,dbo.charindexN('*',a.xsgg,1)-1)
order by count(*) desc;
select substring(a.xsgg,1,dbo.charindexN('*',a.xsgg,2)-1) xsgg,count(a.xsgg) num from T1 a
group by substring(a.xsgg,1,dbo.charindexN('*',a.xsgg,2)-1)
order by count(a.xsgg) desc;
create table T1
( xsgg nvarchar(25),num int)
insert into T1(xsgg,num)
select '20*2000*11500',1 union
select '0.25*1500*2000',1 union
select '20*1500*9000',1 union
select '20*2000*8000',1
你先设置我最佳答案后,我百度Hii教你.