Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL syntax needed
Message
From
28/11/2008 03:44:21
 
 
To
20/11/2008 15:21:12
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 9 SP2
Miscellaneous
Thread ID:
01363325
Message ID:
01364454
Views:
13
>Table 1: fields are Date, and Identification
>
>Table 2: fields are Date, Identification, Amount
>
>How would I build my SQL so that I can get all the amounts from table 2 based on the Id that I got from table 1 for the last date in table 1
>
>Table 1
>===========
>2008/11/18 24
>2008/11/19 25
>
>Table 2
>===========
>2008/11/18 24 75
>2008/11/18 24 55
>2008/11/19 25 12
>2008/11/19 25 40
>2008/11/19 25 22
>
>So the result would be
>
>2008/11/19 25 12
>2008/11/19 25 40
>2008/11/19 25 22
>
>I've been playing a bit but it does'nt work
>
>perhaps with a union? I just thought of that
SELECT *;
FROM Table2;
WHERE id =  (SELECT TOP 1 id FROM Table1 ORDER BY Date DESC)
Previous
Reply
Map
View

Click here to load this message in the networking platform