以下是引用cnfarer在2012-6-18 14:07:34的发言:
locate for zyh>recc()
?"最小空缺号:",recc();
还是得排序吧.
locate for zyh>recc()
?"最小空缺号:",recc();
Select zyh From ypjgk Into Cursor temp Order By zyh Select temp Go Bottom lnMax = temp.zyh Create Cursor temp1 (aa N) For i = 1 To lnMax Insert Into temp1 Values (i) Next Select aa From temp1 Where aa Not in (Select zyh From ypjgk) Into Cursor temp3 Browse
SELECT MIN(zyh) as imin FROM ypjgk INTO CURSOR p_min SELECT p_min GO top iMin = p_min.imin &&得到最小的 ZYH SELECT zyh, RECNO()+iMin-1 as irec FROM ppp ORDER BY zyh INTO CURSOR p_orderby SELECT TOP 1 * FROM p_orderby WHERE zyh<>irec ORDER BY zyh INTO CURSOR p_minres SELECT p_minres GO top ?"最小的断号:", irec