Bringing specific results to the front using one MySQL query.
Posted
by animuson
on Stack Overflow
See other posts from Stack Overflow
or by animuson
Published on 2010-06-05T16:39:26Z
Indexed on
2010/06/05
16:42 UTC
Read the original article
Hit count: 215
I'm setting up my geolocation feature which lists out all the countries in order of name. However, most websites have it set up where the popular countries (such as United States, United Kingdom, Canada, Australia) are at the front of the list (are shown first rather than in their assigned places). Is it possible to achieve this using the same MySQL query that I am already running to select them?
SELECT * FROM `global_flags` ORDER BY `country`
Is there a better alternative somewhere? Perhaps something that can reorganize the results after the database has already been queried? I don't want to exclude those results and then manually type them at the beginning because that would waste more space in the file.
© Stack Overflow or respective owner