遇到难题了,日期之间如何改用-连接?求大侠帮助
怎么把“3号休假,4号休假,5号休假,6号休假,10号休假”变成“3-6号休假,10号休假”。每月日期不固定,把连续的天数用“-”连接。
谢谢!!
CLOSE DATABASES CREATE CURSOR Temp (nValue N(2)) USE Jia IN 0 SELECT Jia SCAN ZAP IN Temp FOR i = 3 TO FCOUNT() IF NOT EMPTY(EVALUATE(FIELD(i))) INSERT INTO Temp VALUES (VAL(SUBSTR(FIELD(i, "Jia"), 2))) ENDIF ENDFOR SELECT MIN(nValue) nMin, ; MAX(nValue) nMax, nId, ; IIF(MIN(nValue) = MAX(nValue), ; TRANSFORM(MIN(nValue)), ; TRANSFORM(MIN(nValue)) + "-" + TRANSFORM(MAX(nValue))) + "号休假" + SPACE(10) 结果 ; FROM (SELECT nValue, nValue - RECNO() nId FROM Temp) cA GROUP BY nId ENDSCAN USE IN Temp
[此贴子已经被作者于2018-10-11 08:29编辑过]