Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Widen number of records by field
Message
De
03/11/2009 07:18:29
Lutz Scheffler
Lutz Scheffler Software Ingenieurbüro
Dresden, Allemagne
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Divers
Thread ID:
01432871
Message ID:
01432882
Vues:
51
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.

Off

There is no place like [::1]
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform