没理解-_-你示意图和说明来看jjsn 字段都是Int为什么最开始的时候写着jjsn(char)??还有,取出前60行以后所谓的1,7,13是指行号?如果取到了第55行(第10次)以后,是返回去取第一行还是怎么?取出的数据你准备放什么地方?

解决方案 »

  1.   

    是我没说清,从说一次----------------------------
    你示意图和说明来看jjsn 字段都是Intjjj是(char)
    jjjsn是(int)
    ----------------
    为什么最开始的时候写着jjsn(char)??
    答:这个应该是int,开始的时候我搞错了。
    --------------------------------------
    还有,取出前60行以后所谓的1,7,13是指行号?
    答:是指行号 改为取40行吧。
    ------------------------------------如果取到了第55行(第10次)以后,是返回去取第一行还是怎么?
    我改为取前40行了,应该是取到第7次后,反回取第3行然后取3+6行就是第9行,这样取够20行
    答:对,是反回取
    1 7 13 19 25 31 37  3 9 15 21 27 33 39 5 11 17 23 29 35
    取出的数据你准备放什么地方? 
    取出的数据我要显示给用户。并写到buylist_log表的other段中。
      

  2.   

    是我没说清,从说一次----------------------------
    你示意图和说明来看jjsn 字段都是Intjjj是(char)
    jjjsn是(int)
    ----------------
    为什么最开始的时候写着jjsn(char)??
    答:这个应该是int,开始的时候我搞错了。
    --------------------------------------
    还有,取出前60行以后所谓的1,7,13是指行号?
    答:是指行号 改为取40行吧。
    ------------------------------------如果取到了第55行(第10次)以后,是返回去取第一行还是怎么?
    我改为取前40行了,应该是取到第7次后,反回取第3行然后取3+6行就是第9行,这样取够20行
    答:对,是反回取
    1 7 13 19 25 31 37  3 9 15 21 27 33 39 5 11 17 23 29 35
    取出的数据你准备放什么地方? 
    取出的数据我要显示给用户。并写到buylist_log表的other段中。
      

  3.   

    set nocount on
    declare @a table
    (
    jjjj char(5),
    jjsn int
    )
    declare @back table
    (
    other char(5)
    )declare @i int
    set @i=1while @i<100
    begin
     insert into @a
     select right(('0000'+rtrim(@i)),5),0
     set @i=@i+1
    endselect top 40 idx=identity(int,1,1),* into #temp from @adeclare @row int
    declare @count int
    set @row=1
    set @count=0
    while @count<=20
    begin
    insert into @back(other)
    select jjjj from #temp
    where idx=@row
    update #temp
    set jjsn=jjsn+1 where idx=@row
    if @row>=40
    set @row=@row-39
    else set @row=@row+6
    set @count=@count+1
    end
    select * from @back
    select * from #temp
    order by jjsn desc
    drop table #temp
    set nocount off
      

  4.   

    表a有两个字段
    jjj (char) 记录数据可能有200行左右
    jjsn (int)记录次数,初始为0次,我取一次加1 比如我在第7行取过一次,哪么第七行的jjsn=1(即0+1)我要从表a的jjj字段取出前40行来。然后在这40行中取1 7 13 19 ......(就是从第一行开始每隔6行取一次)这样循环取够20行 并我每取一个出来就在jjsn字段+1 或全取出来后在+1也可。然后让表a按jjsn字段大小排序。还要把这20写到Buylist_log表的other字段
    ---------------
    就这样子 
    ---------------
    jjj(记录数据) jjsn(记录次数)
    jjj  jjsn
    ------------------
    100  0
    700  0
    130  0
    200  0
    300  0
    400  0
    500  0
    上边是取之前的表的状态
    下边是取之后的表的状态
    jjj  jjjsn
    100  1
    500  1
    700  0
    130  0
    200  0
    300  0
    400  0
    ----------------------
    40行数据的话我应该取的行号是
    1 7 13 19 25 31 37 3 9 15 21 27 33 39 5 11 17 23 29 35
      

  5.   

    为了做数据方便,我jjjj做成连续的了,实际应用当中是从idx列来取行数,与jjjj的数据没有关系