Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SPT to Get a Set of Single Records
Message
 
 
À
29/07/2008 07:12:29
Steven Dyke
Safran Seats USA
Texas, États-Unis
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 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01334815
Message ID:
01334817
Vues:
6
This message has been marked as the solution to the initial question of the thread.
>I have a table with records in which the only difference in the record data might be the recseq no.(This is a many type table). What I need to do is have a SPT statement that gets three fields. The recseq, partnumber, and description fields. The twist is I only want distinct partnumber values. The recseq could be the max for the partnumber maybe.
>

Try (will work in VFP9 or with VFP9 OLE DB provider only)
SELECT mt.recseq, mt.partnumber, mt.description FROM mytable mt
  JOIN (SELECT MAX(recseq) AS maxrecseq, partnumber FROM mytable GROUP BY partnumber) mrs
  ON mrs.maxrecseq = mt.recseq AND mrs.partnumber  = mt.partnumber 
--sb--
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform