Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select 2 fields plus max(field)
Message
From
06/03/1998 12:17:27
 
 
To
06/03/1998 12:11:58
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00083033
Message ID:
00083049
Views:
20
>>I need to select 3 fields from 1 table, but the 3rd field is a max(actiondate). First field is a non-unique ID (many records per ID), the second field is ActionType. I need the record that has the most recent ActionDate for each ID, including the ActionType field. For the life of me, I can not figure out how do this in a SQL statement. There is probably a subquery involved, but I can't figure out how to code it. Anyone got a solution? Something that starts with:
>>Select ID, ActionType, Max(ActionDate) as "ActDate" ;
>>   from Transacts ....
>>TIA.
>
>even simpler
>Select ID,Actiontype,MAX(ActionDate) as "ActDate" From Transacts Group by ID

Sorry, it can create confusing result. Use first suggestion.
Edward Pikman
Independent Consultant
Previous
Reply
Map
View

Click here to load this message in the networking platform