I am trying to create a SQL query that queries a database and returns info on various airports.
The basic query works fine, however the results are returned in a random order.
SELECT * FROM airportdata WHERE airportcode LIKE 'LHR' OR airportcode LIKE 'HKG'
It is really important that they are returned in the order passed into the query (i.e. the airport data from LHR be the first result returned followed by the airport info for HKG), however I can't get find any ORDER BY that will work.
apparently FIND_IN_SET is what I should be using, however I've tried all variations and I can't get it to work!
SELECT * FROM airportdata WHERE airportcode LIKE 'LHR' OR airportcode LIKE 'HKG' ORDER BY FIND_IN_SET(airportcode,'LHR,HKG')
Can anyone see what I'm doing wrong? Thanks!
LIKEwithout any real pattern? Why isn't it just=?order by airportcode desc?