'how to order records in stable query in TDengine?

I created a stable and a few sub-tables, then I used below SQL to list all records, but the result is not ordered by ts column. any way to do it?

select * from stable1



Solution 1:[1]

You can use order by to order your retrieved data.

select * from table order by ts;

example pic

For more infomation about order by you can refer search order by

Solution 2:[2]

You can use order by in a TDengine query sql statement, for example to sort a stable by ts column with descending order.

select * from log.dnodes_info order by ts desc

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 xiaolei
Solution 2 zitsen