吐:SDTA 老师:
如果按照楼主的题意:表一约数千(假设5000),表二约100
用 Occurs() 函数约 1+ 秒,好像还可以接受的。
Close Databases
*!*
表3 : 包含,Query : 不包含:
Clear
Create Cursor 表1 (序号 I, 结果 C(5))
gnLower = 0
gnUpper = 99999
=Rand(-1)
For I = 1 To 5000
Insert Into 表1 Values(I, Right("00000" + Transform(Int((gnUpper - gnLower + 1) * Rand( ) + gnLower)), 5))
Endfor
gnLower = 0
gnUpper = 999
=Rand(-1)
Create Cursor 表2 (序号 I, 结果 C(3))
For I = 1 To 100
Insert Into 表2 Values(I, Right("000" + Transform(Int((gnUpper - gnLower + 1) * Rand( ) + gnLower)), 3))
Endfor
T1 = Seconds( )
Select *, 00000 As 序号2, "
" As 包含 From 表1 Readwrite Into Cursor 表3
Select 表2
Scan
Select 表3
Replace All 表3.序号2 With 表2.序号, 表3.包含 With 表2.结果 For ;
Occurs(Substr(表2.结果, 1, 1), 表3.结果) >= Occurs(Substr(表2.结果, 1, 1), 表2.结果) And ;
Occurs(Substr(表2.结果, 2, 1), 表3.结果) >= Occurs(Substr(表2.结果, 2, 1), 表2.结果) And ;
Occurs(Substr(表2.结果, 3, 1), 表3.结果) >= Occurs(Substr(表2.结果, 3, 1), 表2.结果) And ;
Empty(表3.包含)
Select 表2
Endscan
Select 表3
Go Top
Browse Last Nowait
Select 序号, 结果 As 不包含 From 表2 Where 结果 Not In (Select 包含 From 表3) Into Cursor Query
Browse Last Nowait
Wait Window "耗时 : " + Transform(Seconds( ) - t1) + " 秒"