Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select only a certain number of records from a table
Message
 
 
À
06/02/2002 11:17:04
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00616091
Message ID:
00616117
Vues:
23
>Is there a way that I can select only X amount of records from a table and put them into another table?
>
>Ex.
>TableA has 779696 number of records and is sorted by datetime desc
>I only want the first 30 records and want them in TableB
>What is the best way to do this?
>
>TIA!
Select TOP 30 * ;
  FROM tablea ;
  ORDER BY datetime desc ;
  INTO CURSOR crsTemp

SELECT tableb
APPEND FROM (DBF(crsTemp)) FOR RECNO() <= 30
Select could return more than 30 records if there're more than one record with the same datetime at the bottom of 30 records.
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform