| drop dataverse gby-using-orderby-desc if exists; |
| |
| create dataverse gby-using-orderby-desc; |
| |
| use dataverse gby-using-orderby-desc; |
| |
| create type AddressType as closed { |
| number: int32, |
| street: string, |
| city: string |
| } |
| |
| create type CustomerType as closed { |
| cid: int32, |
| name: string, |
| age: int32?, |
| address: AddressType?, |
| lastorder: { |
| oid: int32, |
| total: float |
| } |
| } |
| |
| create nodegroup group1 if not exists on nc1, nc2; |
| |
| create dataset Customers(CustomerType) |
| primary key cid on group1; |
| |
| write output to nc1:"rttest/gby-using-orderby-desc.adm"; |
| |
| for $c in dataset('Customers') |
| group by $name := $c.name decor $age := $c.age with $c |
| order by $name desc, $age asc |
| return { "name": $name, "age": $age } |
| |