Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Select the records which have a max() of a field
Message
De
18/11/2002 14:05:08
 
 
À
17/11/2002 22:07:29
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00723707
Message ID:
00723972
Vues:
9
This is an extraction from Thread id 715045, Message ID 715885. Maybe this could help.



SELECT a.id, a.nameinfo...
FROM names a
WHERE TTOC(a.effective_date, 1) =
(SELECT MAX(TTOC(b.effective_date, 1)) FROM names b WHERE b.id = a.id)
UNION
SELECT 0 AS id, nameinfo AS ...
FROM names a
WHERE RECNO() = 1
INTO viewNames
ORDER BY 1


SELECT a.*, b.nameinfo..., c.addressinfo
FROM ids a LEFT JOIN viewNames b
ON a.id = NVL(b.id, 0)
LEFT JOIN viewAddress c
ON a.id = NVL(c.id, 0)
Gordon de Rouyan
DC&G Consulting
Edmonton, Alberta
Email: derouyag@shaw.ca
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform