【发布时间】:2021-10-25 10:18:17
【问题描述】:
最近在TDengine中尝试union all,发现有问题:
taos> select count(*) as count, loc from st where ts between 1600000000000 and 1600000000010 group by loc;
count | loc | loc |
==========================================================================================
10 | nchar0 | nchar0 |
10 | nchar1 | nchar1 |
10 | nchar2 | nchar2 |
10 | nchar3 | nchar3 |
10 | nchar4 | nchar4 |
10 | nchar5 | nchar5 |
Query OK, 6 row(s) in set (0.003831s)
taos> select count(*) as count, loc from st where ts between 1600000000020 and 1600000000030 group by loc;
Query OK, 0 row(s) in set (0.002620s)
taos> select count(*) as count, loc from st where ts between 1600000000000 and 1600000000010 group by loc
-> union all
-> select count(*) as count, loc from st where ts between 1600000000020 and 1600000000030 group by loc;
count | loc | loc |
==========================================================================================
10 | nchar0 | nchar0 |
10 | nchar1 | nchar1 |
10 | nchar2 | nchar2 |
10 | nchar3 | nchar3 |
10 | nchar4 | nchar4 |
10 | nchar5 | nchar5 |
Query OK, 6 row(s) in set (0.004686s)
taos> select count(*) as count, loc from st where ts between 1600000000020 and 1600000000030 group by loc
-> union all
-> select count(*) as count, loc from st where ts between 1600000000000 and 1600000000010 group by loc;
count | loc | loc |
==========================================================================================
Query OK, 0 row(s) in set (0.004371s)
从上面的查询中,为什么查询 3 和查询 4 的结果不同?这让我很困惑。
【问题讨论】:
标签: tdengine