'join query error on two super tables of TDengine
I want to join query two super tables of TDengine database.
The super table's schema is here: s1 (ts timestamp, v int) tags (t bindary(64)) s2 (ts timestamp, v int) tags (t bindary(64))
taos> select * from s1, s2 and s1.ts = s2.ts
DB error: invalid SQL: super table join requires tags column
taos> select * from s1, s2 and s1.ts = s2.ts where s1.tag = s2.tag and s1.ts = s2.ts
DB error: syntax error near "tag = s2.tag;"
Could someone help to point me how I can do that?
Solution 1:[1]
just tried your queries on latest version of TDengine database, your queries should be supported now
taos> use test;
Database changed.
taos> create table st1(ts timestamp, v int) tags(t1 binary(64));
Query OK, 0 of 0 row(s) in database (0.003373s)
taos> create table st2(ts timestamp, v int) tags(t1 binary(64));
Query OK, 0 of 0 row(s) in database (0.003044s)
taos> select * from st1,st2 where st1.ts = st2.ts;
Query OK, 0 row(s) in set (0.001480s)
taos> select * from st1,st2 where st1.ts = st2.ts and st1.t1 = st2.t1;
Query OK, 0 row(s) in set (0.000686s)
taos> select * from st1,st2 where st1.ts = st2.ts and st1.t1 = st2.t1 and st1.ts = st2.ts;
Query OK, 0 row(s) in set (0.000728s)
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 | Xiao Ping |
