Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL syntax needed
Message
 
À
20/11/2008 16:15:18
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01363325
Message ID:
01363361
Vues:
15
>Exactly. Thank you Borislav
>
>Another question
>
>INNER JOIN (SELECT MAX(Date) AS Date FROM Table1) Tbl1
>
>I don't understand the tbl1 at the end. Could you please explain that sentence?

To do a Join you need to identify a table. The Select MAX(Date... builds the table but he identifies it as Tbl1 (like a temnporary table name).


>
>
>
>>>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
>>
>>How about:
>>
>>SELECT Table2.*;
>>FROM Table2;
>>INNER JOIN (SELECT MAX(Date) AS Date FROM Table1) Tbl1;
>>           ON Table2.Date = Tbl1.Date;
>>INTO CURSOR crsTest
>>BROWSE NORMAL
>>
____________________________________

Don't Tread on Me

Overthrow the federal government NOW!
____________________________________
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform