Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql: parent - child
Message
De
12/08/2004 09:04:46
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Sql: parent - child
Divers
Thread ID:
00932653
Message ID:
00932653
Vues:
53
I have a table1 (PK=signout_id) and a table2 (PK=sgnout2_id,FK=signout_id)

for each record in table1 I need the last record in table2 (max(insdttm))

is the following sql statement reliable:
(VFP8 SP1)
SELECT table1.signout_id as id1,;
table1.claim_id,; 
  MAX(table2.insdttm),table2.*;
  from signout table1;
   inner JOIN signout2 table2;
   ON table1.signout_id=table2.signout_id;
   GROUP BY 1,2
the table2.* data must belong to the table2 record with the highest insertdatetime (insdttm)

Thanks

Peter
Peter Cortiel
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform