declare @T table (col int) insert into @T select 13 union all select 15 union all select 17 union all select 18 union all select 19select *,col%3 as col的余数 from @T /* col col的余数 ----------- ----------- 13 1 15 0 17 2 18 0 19 1 */
declare @T table (col int) insert into @T select 13 union all select 15 union all select 17 union all select 18 union all select 19select *,col%3 as col的余数 from @T /* col col的余数 ----------- ----------- 13 1 15 0 17 2 18 0 19 1 */一列值的时候就是把 列名%m这样表示即可
declare @T table (col int)
insert into @T
select 13 union all
select 15 union all
select 17 union all
select 18 union all
select 19select *,col%3 as col的余数 from @T
/*
col col的余数
----------- -----------
13 1
15 0
17 2
18 0
19 1
*/
insert into @T
select 13 union all
select 15 union all
select 17 union all
select 18 union all
select 19select *,col%3 as col的余数 from @T
/*
col col的余数
----------- -----------
13 1
15 0
17 2
18 0
19 1
*/一列值的时候就是把 列名%m这样表示即可