This is how i do before query on Yii 2.0
This is a bried guide about displaying of custom sql query results.