Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Expand data with Select statement?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00805975
Message ID:
00806012
Vues:
16
This message has been marked as the solution to the initial question of the thread.
Hi Caroline,

You can do that w/o SCAN
SELECT MAX(qty) as MaxQty ;
	FROM mytable ;
	INTO ARRAY laMaxQty
CREATE CURSOR crsTemp ( Qty I)
FOR i=1 TO laMaxQty[1]
	INSERT INTO crsTemp VALUES (i)
ENDFOR

SELECT mt.Desc ;
	FROM mytable mt ;
		JOIN crsTemp ct ON ct.Qty <= mt.qty ;
	INTO CURSOR crsResult
>Hi all,
>Is it possible to write a select statement that can take a quantity and add that many records to the result?
>What I am trying to achieve is to start with a file containing:
>
>Qty   Desc
> 3    Hello
> 2    Goodbye
>
>And get a resulting table of:
>
>Hello
>Hello
>Hello
>Goodbye
>Goodbye
>
>is this possible or must I just use the old Scan and Insert method?
>
>Thanks in anticipation.
>Caroline
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform