如何在yii2中使用WHERE - LIKE子句并使用区分大小写进行LIKE模式搜索? [重复]

This question already has an answer here:

$aa = India::find();
$players = $aa
            ->where('player LIKE :query', [':query'=>'S%'])
            ->orderBy('position, player')->all();
$countnumber = $aa->count();

This code returns results without case sensitivity. Gives results where Player name starts with 'S' or 's'.

But I want to make, just to select Player names only with 'S'. How to restrict it to select with case sensitivity in PHP Yii2 Framworok ?

</div>

In case you are using MySQL you can make your query with BINARY

So your Yii2 code should be something like this:

$players = India::find()
            ->where(['LIKE BINARY', 'player', $query_parameter])
            ->orderBy('position, player')->all();