没用过 vfp6,不清楚是否允许合成一条 sql 语句来执行,这里分成多条 sql 应该允许吧?
程序代码:
cc = ''
For ii = 1 to 31
cc = cc + '+j' + Ltrim(Str(ii))
EndFor
cc = Substr(cc,2)
Select num, nina, yue, &cc as jx from ffff into cursor ggg
Select num, nina, yue, Occurs('探',jx) hj, At('探',jx) st, Rat('探',jx) et from ggg into cursor ggg
Select num, nina, yue, Sum(hj) as hj, Min(st) st, Max(et) et from ggg where st > 0 group by num,nina,yue into cursor ggg
Select num, nina, yue, hj, 1+Int((st-1)/4) st, 1+Int((et-1)/4) et from ggg into cursor ggg
Select num, nina, hj, Date(nina,yue,st) st, Date(nina,yue,et) et from ggg into cursor ggg
Select num, nina, Min(st) as st, Max(et) et, Sum(hj) jh from ggg group by num, nina into cursor ggg
Browse