This is the query I'm trying below.
SELECT "hour", "gender", SUM("aggrCount") AS "cnt" FROM "my.index" WHERE "batchDate" < XXX AND \"batchDate\" >= XXX AND "hour" in ( 10, 11, 12, 13, 14) GROUP BY "hour", "gender" **ORDER BY "hour" ASC, "cnt" DESC**
Here is described as REST API.
POST /_sql?format=json
{
"query": "SELECT "hour", "gender", SUM("aggrCount") AS "cnt" FROM "my.index" WHERE "batchDate" < XXX AND "batchDate" >= XXX AND "hour" in ( 10, 11, 12, 13, 14) GROUP BY "hour", "gender" ORDER BY "hour" ASC, "cnt" DESC"
}
I indicated order by commands using two values of "hour" and "cnt", but the result was ordered by "cnt" first :
{"columns":[{"name":"hour","type":"long"},{"name":"gender","type":"text"},{"name":"cnt","type":"long"}],"rows":[[10,"f",46.0],[10,"m",43.0],[11,"m",16.0],[12,"m",6.0],[11,"f",2.0],[12,"f",2.0],[14,"m",2.0],[13,"m",1.0]]}
And It works in the same way even if the order by commands are swapped into the reverse order (ORDER BY "cnt" DESC, "hour" ASC).
Is there any way to specify the priority of multiple order by commands?