I have data in DB
Germany
India
USA
China
Japan
Africa
I want a sql query which results:
India (India as first row)
Africa (all the other alphabetically arranged)
Japan
USA
China (China as last row)
I have data in DB
Germany
India
USA
China
Japan
Africa
I want a sql query which results:
India (India as first row)
Africa (all the other alphabetically arranged)
Japan
USA
China (China as last row)
You can use several levels of sorting:
Rationale: in MySQL, expression
col = <val>
returns1
if the condition is fulfilled, else0
. Socol = 'India' desc
puts India first, whilecol = 'China'
puts China last. Ties are then broken with a regular sort on the country name.