declare @i nvarchar(32),@y nvarchar(32),@p int
set @i=''
set @y='☆'
set @p=1
while(@p<=5)
begin
set @i+=@y
print @i
set @p=@p+1
end
--------------------------------------
declare @a int,@b nvarchar(32),@c int,@e nvarchar(32)
set @a=1
set @c=1
set @e='☆'
while(@a<=5)
begin
set @a=@c+1
while(@c<=5)
begin
print @e
set @e=@e+'☆'
set @c=@c+1
end
end
---------------------------------
------------------------------------------------
create table tmp(rq varchar(10),shengfu nchar(1))
select * from tmp
insert into tmp values('2005-05-29','胜')
insert into tmp values('2006-09-05','胜')
insert into tmp values('2005-05-29','胜')
insert into tmp values('2005-05-29','胜')
insert into tmp values('2005-05-29','胜')
insert into tmp values('2005-05-29','负')
insert into tmp values('2006-02-15','负')
insert into tmp values('1995-02-13','负')
select rq,
sum(case when shengfu='胜' then 1 else 0 end) as 胜,
sum(case when shengfu='负' then 1 else 0 end) as 负
from tmp
group by rq