Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

order by number of character in sql

You can also sort or order by the Number of Characters in each Column you wish 
to sort by. Shown below is a sample which sorts by the first three characters 
of the First Name and by the last two characters in the name of the town.

    SELECT *
    FROM table_name
    ORDER BY LEFT(FirstName, 3) ASC, LEFT(Town, 2);
 
PREVIOUS NEXT
Tagged: #order #number #character #sql
ADD COMMENT
Topic
Name
2+3 =