Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Need SQL to find LATEST child record
Message
From
15/04/2003 12:16:08
 
 
To
15/04/2003 09:53:46
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00777700
Message ID:
00777846
Views:
10
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
Previous
Reply
Map
View

Click here to load this message in the networking platform