Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select the records which have a max() of a field
Message
From
18/11/2002 14:05:08
 
 
To
17/11/2002 22:07:29
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00723707
Message ID:
00723972
Views:
8
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
Previous
Reply
Map
View

Click here to load this message in the networking platform