select  * from A where id%2=1

解决方案 »

  1.   

    create table t2(c1 int,c2 varchar(20))
    goinsert into t2 values(1,' 1a')
    go
    insert into t2 values(2,'1a')
    go
    insert into t2 values(3,'1a')
    go
    insert into t2 values(4,'1a')
    go
    insert into t2 values(5,'1a')
    go
    insert into t2 values(6,'1a')
    go
    insert into t2 values(7,'1a')
    go--可以自己设定起始值,步长为几
    select * from t2
    go
    begin
    declare @Start int,@Step int
    select @Start=1
    select @Step=2
    select c1,c2 from t2 where (c1-@Start)%@Step=0
    end
    go