Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need SQL to find LATEST child record
Message
De
15/04/2003 12:16:08
 
 
À
15/04/2003 09:53:46
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00777700
Message ID:
00777846
Vues:
9
Hi John,

cid primary FOR inmates

cinmates_id,ttxndatetm primary FOR acct_events

SELECT cinmates_id,MAX(ttxndatetm) ttxndatetm FROM acct_events WHERE txnstatus = "OPEN" GROUP BY 1 INTO CURSOR tDummy

SELECT A.* FROM FORCE tDummy B JOIN acct_events A JOIN ;
ON A.cinmates_id = B.cinmates_id AND A.ttxndatetm = B.ttxndatetm;
INTO CURSOR tDummy

SELECT * FROM inmates JOIN tDummy;
ON inmates.cid = tDummy.cinmates_id;
INTO CURSOR WHAT_YOU_WANTED

Uses:

Index

SCAN

SEEK

you can get WHAT_YOU_WANTED much more fastly

Fabio
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform