Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Latest price GROUP problem
Message
De
19/11/2013 18:17:49
 
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
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01588299
Message ID:
01588337
Vues:
36
>>Now: How about when the data is in 2 files, FooA and FooB and the latest date could be in either. Could you do this in one SQL statement with UNION? How?
>
>:-)
>
>Select Foo.Item, Foo.date, MAX(Foo.Price) AS Foo.Price ;
>from (SELECT * FROM FooA;
>      UNION ALL;
>      SELECT * FROM FooB) Foo;
>INNER JOIN (SELECT Item, MAX(Date) AS Date;
>            FROM (SELECT * FROM FooA;
>                  UNION ALL;
>                  SELECT * FROM FooB) Foo;
>            GROUP BY Item) Foo1;
>      ON Foo.Item = Foo1.Item AND Foo.Date = Foo1.Date;
>GROUP BY Foo.Item, Foo.date;
>into cursor boo
>
Great! That worked!
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform