日期:2014-05-18  浏览次数:20451 次

ADO循环语句怎么转成sql语句
C/C++ code

        RxRecordset rst;
        sql="select * from A";
    rst.Open(sql);
    while(!rst.end())
    {
        int Id=atoi(rst.GetFieldValue("Id"));
        RxRecordset rs;
        sql.Format("select top 100 * from %s where Id >= %d and Id<%d",B,Id*100,Id*100+99);
        rs.Open(sql);
        while(!rs.isend())
        {
           rs.MoveNext();
        }
        rst.MoveNext();
    }



------解决方案--------------------
探讨

引用:

C/C++ code

RxRecordset rst;
sql="select b.* from B as cross apply(select top 100 * from A where b.Id >= a.id*100 and Id<a.id*100+99) as x";
rst.Open(sql);
while(!rst.isend())
……

------解决方案--------------------
探讨

引用:

引用:

C/C++ code

RxRecordset rst;
sql="select b.* from B as cross apply(select top 100 * from A where b.Id >= a.id*100 and Id<a.id*100+99) as x";
……