Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
One Works, One Doesn't
Message
De
27/06/2006 08:34:54
 
 
À
26/06/2006 16:49:12
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:
01131937
Vues:
19
This pulls all inactive records in untype and the matching records in incilog as it should:

lcSelect = "SELECT " ;
+" * " ;
+" FROM Table1 a LEFT OUTER JOIN Table2 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 untype WHERE inactive = 'TRUE' ) ";
+" ORDER BY a.unitcode, a.unittype, b.timestamp DESC "

However, my goal now is to pull all records in Table1 that have inactive = 'true' (whether or not there is a matching record in Tabl2) but only pull the top 5 matching records in Table2 by timestamp descending (the 5 most recent records in Table2) for each record pulled in Table1 (if any matching records exist in Table2). I am stumped this morning, ideas?
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform