⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

ORDER_BY result is not as expected



Adesh Rohan D'silva
  • profile picture
  • Member

Posted 01 August 2012 - 05:38 AM

i have a table as shown below

std | division | roll_no
2 b 1
4 b 3
2 a 6

I want to achieve the result of this simple query

SELECT * FROM students ORDER BY std ASC , division ASC , roll_no ASC

so my desired result would be


std | division | roll_no
2 a 6
2 b 1
4 b 3

I couldn't find a direct way to use mutiple ORDER BY clauses so I tried the below hack

$crud->order_by('std ASC,division ASC,roll_no','ASC');

but it simply sorts them according to "roll_no" but not "std" and "division"

any tips would be helpful.