MySQL sorting not working as expected

mccoyturtle

New Member
I have one table named companies as below.\[code\]CREATE TABLE IF NOT EXISTS `companies` ( `id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `name` varchar(40) NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;\[/code\]and MySQL talbe data for this table is as below.\[code\]INSERT INTO `companies` (`id`, `user_id`, `name`) VALUES(1, 2, 'Mylan'),(2, 1, 'Intas'),(3, 48, 'Glenmark'),(4, 21, 'Amipharma'),(5, 1, 'XEPA SOUL');\[/code\]now when i sort record using below query\[code\]SELECT * FROM companies ORDER BY name ASC;\[/code\]this i returnning.
  • XEPA SOUL
  • Amipharma
  • Glenmark
  • Intas
  • Mylan
and this is wrong as \[code\]X\[/code\] is coming first and its must be shown last.I do not know why its like this.Please give some hint or explanation so i could correct this.Thanks
 
Back
Top