Hi Sergey,
Be patient we me. Maybe I didn't see the solution
My problem in your words
How can I create (if possible) a cursor with the sequential numbers up to MAX(iChair) temporarly within a SELECT SQL and without an extra created cursor?
Your first example simply creates 2*Reccount() records, I have expressed the problems. The second example runs on an extra cursor this is not what I'm looking for.
So what do I miss?
Agnes
>Hi Agnes,
>
>I already answered all your questions in my previous message. Did you read it?
>
>
>>Thanks for the help.
>>
>>I need
>>
>>MAX(iChair)
>>
>>right ?
>>
>>Your solution returns something like 2* (number non deleted records) with unpredictable numbers. (As soon as something is deleted).
>>
>>and even for a cursor with only undeleted records it would fail for
>>
>>CREATE CURSOR curTable (cTableNumber c(1), iChair I)
>>INSERT INTO curTable VALUES ('4',6)
>>
>>
>>Agnes
>>
>>>Hi Agnes,
>>>
>>>Try
>>>
>>>SELECT cTableNumber, cTableNumber + "." + TRANSFORM(sn) AS cChairNumber ;
>>>FROM curTable ;
>>> JOIN ( ;
>>> SELECT RECNO() AS sn FROM curTable ;
>>> UNION ALL ;
>>> SELECT RECNO() + RECCOUNT() AS sn FROM curTable ) crsNumbers ON curTable.iChair >= crsNumbers.sn
>>>
>>>
>>>The inner select with UNION creates a Numbers table. You can create it any way that works for you. Just make sure that it hold sequential whole numbers with max value not less than # of chairs. For example
>>>
>>>* Create numbers table
>>>lnMaxChairs = 8
>>>CREATE CURSOR crsNumbers (sn i)
>>>FOR i=1 TO lnMaxChairs
>>> INSERT INTO crsNumbers VALUES(i)
>>>ENDFOR
>>>
>>>SELECT cTableNumber, cTableNumber + "." + TRANSFORM(sn) AS cChairNumber ;
>>>FROM curTable ;
>>> JOIN crsNumbers ON curTable.iChair >= crsNumbers.sn
>>>
>>>
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]