Order By Persian Title In MySQL

1: Change Collection Field To “utf8_persian_ci

2: In Query

SELECT * FROM campaigns ORDER BY title COLLATE utf8_persian_ci

3: In Yii Framework

$academics = Academic::find()

->where([

‘organization_id’ => $_POST[‘organization’],

‘academic_year_id’ => $_POST[‘academicYear’],

‘base_id’ => $_POST[‘base’],

‘field_id’ => $_POST[‘field’]

])

->andWhere([‘IN’,’status’,$arrayStatus])

->joinWith(‘profiles p’)

  • >orderBy(new \yii\db\Expression(‘p.lname COLLATE utf8_persian_ci’));

Enjoy It.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store