TDengine的两个超级表上的 join查询错误



我想连接查询TDengine数据库的两个超级表。

超级表的模式如下:S1 (ts timestamp, v int)标记(t bind (64))S2 (ts timestamp, v int) tags (t bind (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;" 

谁能告诉我怎么做?

刚刚在最新版本的TDengine数据库上尝试了您的查询,您的查询现在应该支持

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)

最新更新