Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One Works, One Doesn't
Message
 
À
27/06/2006 08:34:54
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
Network:
Windows 2003 Server
Divers
Thread ID:
01131819
Message ID:
01131968
Vues:
18
TEXT TO lcSelect NOSHOW TEXTMERGE PRETEXT 15
     SELECT * 
            FROM Table1 a
            LEFT JOIN (SELECT * FROM Table2 WHERE incilog.timestamp IN 
                                                   (SELECT TOP 5 timestamp FROM Table2 aInc
                                                          WHERE aInc.unitcode = Table2.unitcode AND
                                                                aInc.unittype= Table2.unittype
                                                          ORDER BY timestamp DESC)) b
           ON  LTRIM(RTRIM(a.unitcode)) = LTRIM(RTRIM(b.unitcode))
           AND LTRIM(RTRIM(a.unittype)) = LTRIM(RTRIM(b.usertyped))
     WHERE a.inactive = 'TRUE' and EXISTS ( SELECT * FROM Table1 WHERE inactive = 'TRUE' )
     ORDER BY a.unitcode, a.unittype, b.timestamp DESC
I am sure there are better ways, but I can't remeber them right now.
I'll try to play with new ranking functions to see what I could do and post my suggestion here.
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform