Information is arranged that You can assign highest to the least. Ascending or time. If the text is Ascending. They are sort of az if a number from 0 up to sort it indefinitely.

Now it is a problem that If we want to give it up before then bangkok to Sandnes and then the Indo.
City.
Sandnes.
Bangkok.
Indo.

We need the functionality required to help Converting words to numbers. Then sort.

SELECT * FROM tbl_city ORDER BY.
(.
CASE city_name.
WHEN "Bangkok" THEN 1.
WHEN "Sandnes" THEN 2.
ELSE 3 END.
) ASC.

If we use CASE to help with the field city_name Bangkok to Sandnes, if converted into a second if it is beyond the then three enough to Bangkok to sort it before.

To solve your problem in a generic way, I'd introduce a sort table containing your city and a sortorder column. Your query can then join this table and use it to sort it the way you want. This is also much easier if you want to change the sort order later on.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.