Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Selecting Records
Message
De
24/12/2009 07:39:58
 
 
À
24/12/2009 06:54:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01440504
Message ID:
01440507
Vues:
91
This message has been marked as the solution to the initial question of the thread.
>Hi All,
>
>Need a little help to construct an efficient SELECT statement. I have a cursor containing N records. I want to select every Xth record startng with and including the last record in the source cursor. So I want records:
>
>N
>N - X*1
>N - X*2
>N - X*3
>...
>...
>
>What is the select statement for this keeping in mind also that X will probbaly not be a factor of N. i.e. I may have 79 records and require every 7th record starting from the last record going backwards.
>
>Thanks
,
Jos,

If the cursor is already in the right order
select * from CursorName ;
     where ( empty(mod(recno() - 79, 7)) )


or starting with last record

select recno() as xx,  * from CursorName ;
     where ( empty(mod(recno() - 79, 7)) ) ;
     order by 1 desc
Gregory
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform