blob: 682800cadcfb5281514bba4103379a88dd830bb5 [file] [log] [blame]
vinayakb38b7ca42012-03-05 05:44:15 +00001drop dataverse gby-using-orderby-desc if exists;
2
3create dataverse gby-using-orderby-desc;
4
5use dataverse gby-using-orderby-desc;
6
7create type AddressType as closed {
8 number: int32,
9 street: string,
10 city: string
11}
12
13create type CustomerType as closed {
14 cid: int32,
15 name: string,
16 age: int32?,
17 address: AddressType?,
18 lastorder: {
19 oid: int32,
20 total: float
21 }
22}
23
24create nodegroup group1 if not exists on nc1, nc2;
25
26create dataset Customers(CustomerType)
27 partitioned by key cid on group1;
28
29write output to nc1:"rttest/gby-using-orderby-desc.adm";
30
31for $c in dataset('Customers')
32group by $name := $c.name decor $age := $c.age with $c
33order by $name desc, $age asc
34return { "name": $name, "age": $age }
35