Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Join with Top 1 Select?
Message
De
02/12/2004 19:25:45
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
How to Join with Top 1 Select?
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
00966581
Message ID:
00966581
Vues:
57
I'm creating a local view where I need only the top result from one of the tables in the view, but all the records in another. IE: All Customers, but only the most recent Invoice for each.

SELECT cust.CustID, cust.LastName, cust.FirstName, Invoice.InvoiceID, Invoice.InvoiceNum, Invoice.Date FROM cust INNER JOIN invoice ON cust.CustID = invoice.cust ID (TOP 1 IN invoice????)

Because it's a local view, I can't gracefully do it with a subquery, and I'd prefer to avoid SCANning through customer and inserting the results. A GROUP BY doesn't seem to work because I need the actual values from invoice, so I'm stuck.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform