Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SQL command: syntax needed
Message
De
22/03/2004 11:47:32
 
 
À
22/03/2004 11:07:51
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00888526
Message ID:
00888555
Vues:
15
Dan,

>Hmmm...that wouldn't work, that would only give you the very first one. You'd need a group by clause to make it work properly. Here's an example using the Northwind.Orders table:
>
>select freight, orderdate from orders
>where orderid in
>(select min(orderid) from orders
>group by datepart(yy,orderdate))

I'm trying to remember the correct correlated subquery to use, which I once got from the Advanced SQL book on your bookshelf at EPS. Had to use that to find the most recent invoice for each customer or something like that.

There were two examples there of how to accomplish it, with one using MAX and the other with a having clause, but I just cannot come up with it today for some reason. VFP8 keeps giving me "Command is missing required clause" or "Function name is missing )" (when it is not missing) on everything I tried so far. :-)

Surely someone knows the answer to the original question (to do it in one select) and will chime in here.
David Stevenson, MCSD, 2-time VFP MVP / St. Petersburg, FL USA / david@topstrategies.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform