Instead of TOP 5 DistKm FROM SCLeague
you can probably use

DistKm SORTED BY DistKm DESCENDING LIMIT 5

The rest about temp files is probably best to read
Goran Bobic's mail.


Billy Reed wrote:

> I am new to MySQL and am trying to convert :
> 
> SELECT SUM(DistKm) AS Distance FROM (SELECT TOP 5 DistKm FROM XCLeague WHERE
> LoginID='billyreed' AND HGPG='PG' ORDER BY DistKm DESC)
> 
> This is a subselect which selects the top 5 cross country flight distances
> of hang glider pilots (for a specific pilot) and then sums the result for
> each pilot. Subsequent code writes this to a new table showing who is in the
> lead !!
> 
> Can anyone suggest how this is done in MySQL. It doesnt seem to like the TOP
> 5 syntax.
> 
> I have been able to convert the rest of my site from MS Access to MySQL but
> am struggling with this.
> 
> many thanks in anticipation.
> 
> Billy Reed
> 
> 
> ---------------------------------------------------------------------
> Before posting, please check:
>    http://www.mysql.com/manual.php   (the manual)
>    http://lists.mysql.com/           (the list archive)
> 
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <[EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
> 
> 
> 


-- 
Steve Rapaport
World Citizen


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to