# How to order result of groupby

**URL:** <https://discuss.dgraph.io/t/how-to-order-result-of-groupby/17124>\
**Category:** Dgraph\
**Tags:** kind:question, dgraph\
**Created:** [April 6, 2022, 11:56pm UTC](https://discuss.dgraph.io/t/how-to-order-result-of-groupby/17124 "2022-04-06T23:56:03Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aya\_Ben\_Ali](https://yyz1.discourse-cdn.com/flex007/user_avatar/discuss.dgraph.io/aya_ben_ali/32/9509_2.png) [@Aya\_Ben\_Ali](https://discuss.dgraph.io/u/Aya_Ben_Ali)\
**Post date:** [April 6, 2022, 11:56pm UTC](https://discuss.dgraph.io/t/how-to-order-result-of-groupby/17124/1 "2022-04-06T23:56:03Z")

</div>

I have problem in order result of groupby

> Blockquote {

var(func:has(evt\_country))@filter(uid\_in(project\_uid, 0xe230)) @groupby(evt\_country) {  
t as count(uid)  
}  
res(func:uid(t), orderasc:val(t) ){  
val(t)  
}

}

this my query but I got error " Vars can be assigned only when grouped by UID attribute" because evt\_country it’s not an uid
