27-06-2006, 07:05 PM
When I execute this query, which is copied from the fsplistcfg.php script:
SELECT `DepartureIcaoName`, CONCAT( SUM( FlightResult LIKE 'Perfect' ) / COUNT( `DepartureIcaoName` ) *100, '%' ) AS TFlightPerfect FROM `flights`
GROUP BY `DepartureIcaoName` ORDER BY TFlightPerfect DESC
This is the result:
DepartureIcaoName TFlightPerfect
LECO - A Coruna - Spain 88.8889
LEAL - Alicante - Spain 85.7143
LEGR - Granada - Spain 83.3333
LEMG - Malaga - Spain 72.7273
GCHI - Hierro - Canary Islands 66.6667
LEIB - Ibiza - Spain 50.0000
CYYT - St Johns Intl - Canada 50.0000
ENGM - Oslo Gardermoen - Norway 50.0000
LEBL - Barcelona - Spain 50.0000
LELL - Sabadell - Spain 25.0000
LXGB - Gibraltar - Gibraltar 100.0000
BIRK - Reykjavik - Iceland 100.0000
GCLP - Gran Canaria - Canary Islands 100.0000
LEGE - Girona - Spain 100.0000
LFPG - Charles De Gaulle - France 100.0000
LEBZ - Talavera La Real - Spain 100.0000
CYUL - Montreal Intl Dorval - Canada 100.0000
LEPA - Palma De Mallorca - Spain 100.0000
KSLC - Salt Lake City Intl - Usa 0.0000
RCTP - Chiang Kai Shek Intl - Taiwan 0.0000
LETO - Torrejon - Spain 0.0000
RJAA - New Tokyo Intl - Japan 0.0000
EDDP - Leipzig Halle - Germany 0.0000
As you can see, 100 (per cent) is almost at the bottom, just before 0 (per cent) when it should be the first on the list
If I use ORDER BY ASC, the first flights to appear are the ones with 0%, then the 100% and then the 25%, 50%, 66,6667%.. ascending.
¿How can I get a list in descending order with 100% at the top and 0% at the bottom?
SELECT `DepartureIcaoName`, CONCAT( SUM( FlightResult LIKE 'Perfect' ) / COUNT( `DepartureIcaoName` ) *100, '%' ) AS TFlightPerfect FROM `flights`
GROUP BY `DepartureIcaoName` ORDER BY TFlightPerfect DESC
This is the result:
DepartureIcaoName TFlightPerfect
LECO - A Coruna - Spain 88.8889
LEAL - Alicante - Spain 85.7143
LEGR - Granada - Spain 83.3333
LEMG - Malaga - Spain 72.7273
GCHI - Hierro - Canary Islands 66.6667
LEIB - Ibiza - Spain 50.0000
CYYT - St Johns Intl - Canada 50.0000
ENGM - Oslo Gardermoen - Norway 50.0000
LEBL - Barcelona - Spain 50.0000
LELL - Sabadell - Spain 25.0000
LXGB - Gibraltar - Gibraltar 100.0000
BIRK - Reykjavik - Iceland 100.0000
GCLP - Gran Canaria - Canary Islands 100.0000
LEGE - Girona - Spain 100.0000
LFPG - Charles De Gaulle - France 100.0000
LEBZ - Talavera La Real - Spain 100.0000
CYUL - Montreal Intl Dorval - Canada 100.0000
LEPA - Palma De Mallorca - Spain 100.0000
KSLC - Salt Lake City Intl - Usa 0.0000
RCTP - Chiang Kai Shek Intl - Taiwan 0.0000
LETO - Torrejon - Spain 0.0000
RJAA - New Tokyo Intl - Japan 0.0000
EDDP - Leipzig Halle - Germany 0.0000
As you can see, 100 (per cent) is almost at the bottom, just before 0 (per cent) when it should be the first on the list
If I use ORDER BY ASC, the first flights to appear are the ones with 0%, then the 100% and then the 25%, 50%, 66,6667%.. ascending.
¿How can I get a list in descending order with 100% at the top and 0% at the bottom?