Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Query not working right
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Query not working right
Divers
Thread ID:
00726732
Message ID:
00726732
Vues:
35
I have a one to many table. For each entry in table1 I want to find the last entry in table2.

Here is my query and and sample tables:
SELECT Table1.id, Table1.vname, Table2.Name ;
FROM Table1 INNER JOIN Table2 ;
ON Table1.id = Table2.id ;
GROUP BY 1
table1:
id   vname
============
100 veh1
200 veh2
table2:
id   name
=============
100 "James"
200 "tammy"
100 "john"
100 "cindi"
200 "angie"
200 "thomas"
100 "austin"
The Results I am trying to get is:

100 veh1 "austin"
200 veh2 "thomas"

but the problem is that the query above doesn't guarantee the last record from table2. Is there a way I can rewrite this query so that I will alway get the last record from the 100 and 200 series entered in table2.

Thanks
Nick Patel
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform