Ashu
Ashu

Reputation: 402

Groupby using GORM or MySql

My table has three column

created(Date)
score(int)(value is between 1-3)
id(long)

currently I am using Grails(GORM)

 def listData= DaSes.createCriteria().list([max: 5, order: 'desc', sort: 'created']) { 
            projections {
                groupProperty('created')
                count('id')
            }
        }

[[date,count(of all scores)],[date,count(of all scores),...]

But I want result like this

[[date,count(of all scores),count(score1 for current day),count(score2 current day),count(score3 current day)],....]

Please guide me in this .

Upvotes: 3

Views: 788

Answers (1)

Aman
Aman

Reputation: 56

This is logically not possible.If you are using Group by on multiple columns then it gives GROUPBY MULTIPLE COLUMN OUTCOME

And this result is correct.

Upvotes: 3

Related Questions