Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to Join with Top 1 Select?
Message
From
03/12/2004 10:23:02
 
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
00966581
Message ID:
00966716
Views:
7
>Hi Chris,
>
>Try
OPEN DATABASE (HOME(2) + "Northwind\Northwind")
>SELECT DIST ;
>		Customers.customerid, Customers.contactname, ;
>		Invoices.OrderID, Invoices.orderdate ;
>	FROM Customers ;
>		JOIN Invoices ON Customers.customerid = Invoices.customerid ;
>	WHERE Invoices.customerid + DTOS(Invoices.orderdate) IN ( ;
>			SELECT customerid + MAX(DTOS(orderdate))  FROM Invoices ;
>				GROUP BY customerid)
>
The compound key ought to do the trick. I need more than one field, so MAX() may not give me the right answer, but it's definitely the place to start. Just in case you don't hear it enough: Thanks again, Sergey.

Chris.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform