Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SELECTing MAX()
Message
From
14/12/2000 08:52:13
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
To
13/12/2000 18:17:25
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
Miscellaneous
Thread ID:
00452686
Message ID:
00453279
Views:
32
>>>Hi Dragan
>>>
>>>I've tried to do that kind of query in one line and even asked for more input here on the UT, but apparently its not possible in VFP's SQL implementation.
>>>
>>>I'm going to ask if VFP 7 can do it.
>>
>>How about something like
>>
>>SELECT * FROM MyCursor cur1;
>>WHERE score IN (SELECT MAX(score) FROM MyCursor cur2 WHERE cur1.id=cur2.id)
>
>This will get all records which match the highest score per individual. I'm not sure I can get just the first one, or last one.

This is the same as I had proposed (except this is the one-liner I couldn't remember) - so if someone has reached his maximal score twice (or more), we'd be getting two (or more) records for the guy. I figure weeding that out can be done by grouping by ID, or maybe shouldn't be done at all, depending on what's the purpose of the whole thing.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Reply
Map
View

Click here to load this message in the networking platform