Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Query not working right
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Query not working right
Miscellaneous
Thread ID:
00726732
Message ID:
00726732
Views:
34
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
Next
Reply
Map
View

Click here to load this message in the networking platform