group by in yii2 grid view


(Arunwebber) #1

Hi, I have a table which is counting impressions views and clicks of particular videos.

Goes this way.

[attacIment=7650:Selection_119.png]

Now i want to show in impression column total number of clicks for a particular ad id and the impressions should not be counted if the impression is coming from the same IP. How can I do that in grid view? Ip I am counting in user_ip column which is commented out in the grid view.

Publisher id doesn’t matter the query which I am using in grid view is as follows.


'dataProvider'=>new ActiveDataProvider([

            'query' => Adanalytics::find()->

                  where(['publisher_id' =>  Yii::$app->user->identity->id ]),

        ]),


(Arunwebber) #2

https://www.yiiframework.com/forum/index.php/topic/76764-displaying-data-in-grid-view/page__p__316542__fromsearch__1#entry316542

This is solved the issue