Click here to Skip to main content
15,880,972 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have data of students in Guajarati in MySQL database and I want to sort the roll numbers while fetching data from database but roll number is in Guajarati so it is not sorting properly

What I have tried:

I have tried
ORDER BY rollno*1 ASC
while fetching data from database but it doesn't work
Posted
Updated 10-Oct-22 4:06am
Comments
Richard Deeming 6-Oct-22 8:59am    
"It doesn't work" tells us nothing. You need to show some sample data, explain what the expected output is, and provide the full details of what you have tried, any errors you are getting, and where you are stuck.

1 solution

Numbers do not have a language per se so you must be storing this data in a text field - that is your problem. You should always use the correct data type - how it "looks" is a problem for the presentation layer to solve, not the database.

Other options include (potentially) using Collate in your query (this will badly affect performance though) - see MySQL :: MySQL 8.0 Reference Manual :: 10.8.1 Using COLLATE in SQL Statements[^]

You overcome the performance hit, you could add another column that holds the rollno "translated" (make sure this is the one referred to in the indexes)

This OP had a similar issue, there are some suggestions on how to get around it convert-amount-from-english-to-other-language-in-sql-server[^] - you could adapt the function for Bangla to Gujarati to get the extra column I mentioned.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900