mirror of
https://github.com/taosdata/TDengine
synced 2026-05-24 10:09:01 +00:00
339 lines
20 KiB
Text
339 lines
20 KiB
Text
|
|
taos> use test;
|
|
Database changed.
|
|
|
|
taos> select * from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
|
|
|
taos> select * from a1 a join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
|
|
|
|
taos> select a.* from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
|
|
|
taos> select b.* from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
|
|
|
taos> select b.* from a1 a join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
|
|
|
|
taos> select a.*, b.ts from a1 a join (select now as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
|
|
|
|
taos> select b.c from a1 a join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
|
|
|
taos> select b.ts from a1 a join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
|
|
|
taos> select * from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
|
|
|
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
|
|
|
taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
|
|
|
taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
|
|
|
|
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:01.000 | 102 | 1012 |
|
|
2025-10-23 00:00:00.000 | 103 | 1013 |
|
|
2025-10-23 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.ts1,a.ts from a1 a join (select now as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
|
|
|
|
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:01.000 | 102 | 1012 |
|
|
2025-10-23 00:00:00.000 | 103 | 1013 |
|
|
2025-10-23 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
|
c |
|
|
======
|
|
a |
|
|
a |
|
|
a |
|
|
a |
|
|
|
|
taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:01.000 |
|
|
2025-10-23 00:00:00.000 |
|
|
2025-10-23 00:00:02.000 |
|
|
|
|
taos> select * from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select * from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-23 00:00:03.000 | 204 | 2 | 2025-10-23 00:00:03.000 | 404 | 2 |
|
|
|
|
taos> select * from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
|
|
|
taos> select * from (select now as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
|
|
|
|
taos> select a.* from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
|
|
|
taos> select b.* from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
|
|
|
taos> select b.* from (select now as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
|
|
|
|
taos> select b.c from (select now as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
|
|
|
taos> select b.ts from (select now as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
|
|
|
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
|
|
|
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
|
|
|
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
|
|
|
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
|
|
|
|
taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
|
|
|
|
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:01.000 | 102 | 1012 |
|
|
2025-10-23 00:00:00.000 | 103 | 1013 |
|
|
2025-10-23 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
|
c |
|
|
======
|
|
a |
|
|
a |
|
|
a |
|
|
a |
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:01.000 |
|
|
2025-10-23 00:00:00.000 |
|
|
2025-10-23 00:00:02.000 |
|
|
|
|
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
|
|
|
|
taos> select * from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
|
|
|
taos> select * from a1 a , (select now as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
|
|
|
|
taos> select a.* from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
|
|
|
taos> select b.* from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
|
|
|
taos> select b.c from a1 a , (select now as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
|
|
|
taos> select b.ts from a1 a , (select now as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
|
|
|
taos> select b.ts1 from a1 a , (select now as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
|
|
|
|
taos> select * from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
|
|
|
taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
|
|
|
taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
|
|
|
taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
|
|
|
|
taos> select b.ts1 from a1 a , (select now as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
|
|
|
|
taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:01.000 | 102 | 1012 |
|
|
2025-10-23 00:00:00.000 | 103 | 1013 |
|
|
2025-10-23 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
|
c |
|
|
======
|
|
a |
|
|
a |
|
|
a |
|
|
a |
|
|
|
|
taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:01.000 |
|
|
2025-10-23 00:00:00.000 |
|
|
2025-10-23 00:00:02.000 |
|
|
|
|
taos> select * from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select * from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now order by tb.val;
|
|
|
|
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now ;
|
|
|
|
taos> select * from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
|
|
|
taos> select * from (select now as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
|
|
|
|
taos> select a.* from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
|
|
|
taos> select b.* from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
|
|
|
taos> select b.c from (select now as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
|
|
|
taos> select b.ts from (select now as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
|
|
|
taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
|
|
|
|
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
|
|
|
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
|
|
|
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
|
|
|
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
|
|
|
|
taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
|
|
|
|
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:01.000 | 102 | 1012 |
|
|
2025-10-23 00:00:00.000 | 103 | 1013 |
|
|
2025-10-23 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
|
c |
|
|
======
|
|
a |
|
|
a |
|
|
a |
|
|
a |
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:01.000 |
|
|
2025-10-23 00:00:00.000 |
|
|
2025-10-23 00:00:02.000 |
|
|
|
|
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
|
|
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now order by tb.val;
|
|
|
|
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now ;
|
|
|