Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to do this?
Message
De
31/03/2005 08:54:55
 
 
À
30/03/2005 23:31:43
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP1
Network:
Windows 2000 Server
Database:
Visual FoxPro
Divers
Thread ID:
01000176
Message ID:
01000297
Vues:
14
>Hi,
>I have records as below
>
>Name         Date         Action
>--------------------------------
>John         01/01/2005    Y
>John         01/03/2005    T
>John         01/04/2005    F
>
>I need to transform these records to :
>
>Name         Date         Date2        Action
>---------------------------------------------
>John         01/01/2005   28/02/2005     Y
>John         01/03/2005   31/03/2005     T
>John         01/04/2005   / /            F
>
>
>The date of next record will be the date2 of current record.
>

In VFP 9, you could do something like this:

SELECT Name, Date AS Date1, ;
(SELECT MIN(Date) FROM Table T2 ;
WHERE T2.Name = Table.Name ;
AND T2.Date > Table.Date ;
AND T2.Action = Table.Action) AS Date2, ;
Action ;
FROM Table ;
INTO CURSOR NewTable

You'll probably have to tweak this, but it should give you the idea.

Tamar
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform