Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Always trips me up!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01233129
Message ID:
01233191
Vues:
14
>I prefer that way:
>
>CREATE CURSOR Members       (MemberId int, Name C(20))
>CREATE CURSOR StatusHistory (MemberId int, ChangeDate D, Status C(1))
>INSERT INTO Members       VALUES (1, [mike])
>INSERT INTO StatusHistory VALUES (1, DATE(2005,1,1), [I])
>INSERT INTO StatusHistory VALUES (1, DATE(2007,1,1), [A])
>
>SELECT * ;
>  FROM Members mb ;
>  INNER JOIN;
>    (SELECT ff.* FROM StatusHistory ff;
>         INNER JOIN (SELECT MemberId, MAX(ChangeDate) AS ChangeDate;
>                            FROM StatusHistory ttt;
>                            GROUP BY MemberId) ss;
>               ON ff.MemberId = ss.MemberId AND;
>                  ff.ChangeDate = ss.ChangeDate) sh;
>   ON Mb.MemberId =sh.MemberId
>
>
>Sergey's suggestion would works also (Hmmm, did you have any doubt about it :o))

Mine would too, if you design your tables correctly and have PK in each table :)
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform