sqlserver怎么写循环语句( 二 )


begin
while(@day_tmp < '30')
begin
select * from table1 where [email protected]_tmp and [email protected]_tmp
set @day_tmp = @day_tmp + 1
end
set @month_tmp = @month_tmp + 1
set @day_tmp = 1
end
*********************************************************
select * from table1 where
month in('1','2','3','4','5','6','7','8','9','10','11','12'
and
day in('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30');
---
以上 , 希望对你有所帮助 。

sqlserver怎么写循环语句

文章插图