回复 30楼 fdqzy
逻辑运算
以下是引用fdqzy在2020-9-14 19:52:51的发言:
---对筛选数据统计
CLOSE TABLES all
USE b1 IN 0 ALIAS t1
BLANK FIELDS s1_3,s4 all
For i=10 To RECCOUNT()
GO i
p1=ALLTRIM('a')+ALLTRIM('1')
p11=&p1 &&确定要统计个数的对象
qs=jnh
Select * From t1 Where jnh>qs-10 And jnh<=qs Into Cursor ls &&筛选10行数据
Count For a1=p11 Or a2=p11 To tj &&对筛选数据统计
Use
Select t1
GO i
REPLACE s1_3 with 'S1_3' for tj>0 AND tj<=3 AND RECNO()=i
REPLACE s4 with 'S4' for tj>3 AND RECNO()=i
ENDFOR
brow
如何改进?谢谢!
---对筛选数据统计
CLOSE TABLES all
USE b1 IN 0 ALIAS t1
BLANK FIELDS s1_3,s4 all
For i=10 To RECCOUNT()
GO i
p1=ALLTRIM('a')+ALLTRIM('1')
p11=&p1 &&确定要统计个数的对象
qs=jnh
Select * From t1 Where jnh>qs-10 And jnh<=qs Into Cursor ls &&筛选10行数据
Count For a1=p11 Or a2=p11 To tj &&对筛选数据统计
Use
Select t1
GO i
REPLACE s1_3 with 'S1_3' for tj>0 AND tj<=3 AND RECNO()=i
REPLACE s4 with 'S4' for tj>3 AND RECNO()=i
ENDFOR
brow
如何改进?谢谢!
REPLACE ...... for ...,带FOR子句,如果不指定记录范围相当于 REPLACE ALL
精简部份:
程序代码:
GO 10 SCAN REST p11 = a1 qs = jnh SELECT COUNT(*) FROM t1 WHERE BETWEEN(jnh,qs-9,qs) AND (a1=p11 OR a2=p11) INTO ARRAY tj REPLACE s1_3 WITH IIF(tj>0 AND tj<=3, 'S1_3', ''), s4 WITH IIF(tj>3, 'S4', '') ENDSCAN