Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Expand data with Select statement?
Message
De
02/07/2003 04:00:14
 
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:
00805976
Vues:
27
>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

Caroline,

I would say yes to the old Scan and Insert method.

Although you can maybe speed it up a bit (but if do not have a large number of records in the resulting table, I wouldn't even do it)
&& set talk off
scan all
    dime ArrayName[qty]
    ArrayName = Desc  && sets each element to Desc
    select Destination
    append from array ArrayName
    select Source
endscan
Gregory
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform