sort gridview by relation count

hi there

i have 2 tables, imagine tbl_exam and tbl_question

there is no problem in showing question count for each exam in exam gridview, but how can i sort the exam’s gridview by question count?

thanks in advance!

You can define "question_count" attribute in Exam model.

And … look at the following:

got help from this link:مرتب-کردن-بر-اساس-تعداد-relation