mirror of
https://github.com/taosdata/TDengine
synced 2026-05-24 10:09:01 +00:00
959 lines
63 KiB
Text
959 lines
63 KiB
Text
|
|
taos> use test;
|
|
Database changed.
|
|
|
|
taos> select * from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
|
ts | f | g | ts | f | g | 'a' |
|
|
==================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select * from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
|
|
ts | f | g | ts1 | f | g | 'a' |
|
|
==================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select a.* from a1 a join (select today as 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:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
|
ts | f | g | 'a' |
|
|
============================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.* from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
|
|
ts1 | f | g | 'a' |
|
|
============================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select a.*, b.ts from a1 a join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
|
|
ts | f | g | ts |
|
|
================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:01.000 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select b.c from a1 a join (select today as 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 today as 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:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
|
ts | f | g | ts1 | ts | f | g | 'a' |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
|
|
c |
|
|
======
|
|
a |
|
|
a |
|
|
a |
|
|
a |
|
|
|
|
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
|
ts | f | g | ts1 | ts | f | g | c |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:01.000 | 102 | 1012 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
__tomorrow__ 00:00:00.000 | 103 | 1013 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
__tomorrow__ 00:00:02.000 | 104 | 1014 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select a.* from a1 a join (select today 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 |
|
|
__tomorrow__ 00:00:00.000 | 103 | 1013 |
|
|
__tomorrow__ 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
|
|
ts1 | ts | f | g | c |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.ts1,a.ts from a1 a join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
|
|
ts1 | ts |
|
|
====================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
|
ts | f | g | ts1 | ts | f | g | 'a' |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:01.000 | 102 | 1012 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
__tomorrow__ 00:00:00.000 | 103 | 1013 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
__tomorrow__ 00:00:02.000 | 104 | 1014 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select a.* from a1 a join (select today 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 |
|
|
__tomorrow__ 00:00:00.000 | 103 | 1013 |
|
|
__tomorrow__ 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from a1 a join (select today 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 today 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 |
|
|
__tomorrow__ 00:00:00.000 |
|
|
__tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
ts | f | g | ts1 | ts | f | g | 'a' |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
c |
|
|
======
|
|
a |
|
|
|
|
taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
ts | f | g | ts1 | ts | f | g | 'a' |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
c |
|
|
======
|
|
a |
|
|
|
|
taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:01.000 |
|
|
__tomorrow__ 00:00:00.000 |
|
|
__tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:01.000 |
|
|
__tomorrow__ 00:00:00.000 |
|
|
__tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by ts desc) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select b.ts from (select today 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 today 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 today 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 today 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;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 301 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 302 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 303 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 304 | 1 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 401 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 402 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 403 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 404 | 2 |
|
|
|
|
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 today 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=today where tb.ts=today order by tb.val;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 301 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 302 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 303 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 304 | 1 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 401 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 402 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 403 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 404 | 2 |
|
|
|
|
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 today 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>today where tb.ts>today;
|
|
|
|
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 |
|
|
============================================================================================================
|
|
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
|
|
|
|
taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
|
ts | f | g | 'a' | ts | f | g |
|
|
==================================================================================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select * from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
|
|
ts1 | f | g | 'a' | ts | f | g |
|
|
==================================================================================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select a.* from (select today as 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:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
|
ts | f | g | 'a' |
|
|
============================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.* from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
|
|
ts1 | f | g | 'a' |
|
|
============================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from (select today as 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 today as 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:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
|
ts1 | ts | f | g | 'a' | ts | f | g |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
|
|
c |
|
|
======
|
|
a |
|
|
a |
|
|
a |
|
|
a |
|
|
|
|
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
|
|
ts1 |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' | ts | f | g |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a | 2025-10-22 00:00:01.000 | 102 | 1012 |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select a.* from (select today 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 |
|
|
__tomorrow__ 00:00:00.000 | 103 | 1013 |
|
|
__tomorrow__ 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from (select today 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 today 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 |
|
|
__tomorrow__ 00:00:00.000 |
|
|
__tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' | ts | f | g |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
c |
|
|
======
|
|
a |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
ts1 | ts | f | g | 'a' | ts | f | g |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
c |
|
|
======
|
|
a |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from (select today 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 today 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 today 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;;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-22 00:00:00.000 | 301 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 302 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 303 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 304 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 401 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 402 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 403 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 404 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
|
|
taos> select * from (select today 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=today where tb.ts=today order by tb.val;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-22 00:00:00.000 | 301 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 302 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 303 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 304 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 401 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 402 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 403 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 404 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
|
|
taos> select * from (select today 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>today where tb.ts>today;
|
|
|
|
taos> select * from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
|
ts | f | g | ts | f | g | 'a' |
|
|
==================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select * from a1 a , (select today as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
|
|
ts | f | g | ts1 | f | g | 'a' |
|
|
==================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select a.* from a1 a , (select today as 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:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
|
ts | f | g | 'a' |
|
|
============================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from a1 a , (select today as 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 today as 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:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
|
|
ts1 |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
|
ts | f | g | ts1 | ts | f | g | 'a' |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
|
|
c |
|
|
======
|
|
a |
|
|
a |
|
|
a |
|
|
a |
|
|
|
|
taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
|
|
ts1 |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
|
ts | f | g | ts1 | ts | f | g | 'a' |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:01.000 | 102 | 1012 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
__tomorrow__ 00:00:00.000 | 103 | 1013 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
__tomorrow__ 00:00:02.000 | 104 | 1014 | 2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select a.* from a1 a , (select today 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 |
|
|
__tomorrow__ 00:00:00.000 | 103 | 1013 |
|
|
__tomorrow__ 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from a1 a , (select today 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 today 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 |
|
|
__tomorrow__ 00:00:00.000 |
|
|
__tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
ts | f | g | ts1 | ts | f | g | 'a' |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
c |
|
|
======
|
|
a |
|
|
|
|
taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
ts | f | g | ts1 | ts | f | g | 'a' |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 | 2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
c |
|
|
======
|
|
a |
|
|
|
|
taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:01.000 |
|
|
__tomorrow__ 00:00:00.000 |
|
|
__tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:01.000 |
|
|
__tomorrow__ 00:00:00.000 |
|
|
__tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by ts) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
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 today 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 today 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 today 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;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 301 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 302 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 303 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 304 | 1 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 401 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 402 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 403 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 404 | 2 |
|
|
|
|
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 today 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=today order by tb.val;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 301 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 302 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 303 | 1 |
|
|
2025-10-22 00:00:00.000 | 101 | 1 | 2025-10-22 00:00:00.000 | 304 | 1 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 401 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 402 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 403 | 2 |
|
|
2025-10-22 00:00:00.000 | 201 | 2 | 2025-10-22 00:00:00.000 | 404 | 2 |
|
|
|
|
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 today 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>today ;
|
|
|
|
taos> select * from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
|
ts | f | g | 'a' | ts | f | g |
|
|
==================================================================================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select * from (select today as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
|
|
ts1 | f | g | 'a' | ts | f | g |
|
|
==================================================================================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select a.* from (select today as 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:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
|
ts | f | g | 'a' |
|
|
============================================================
|
|
2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from (select today as 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 today as 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:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
|
|
ts1 |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
|
ts1 | ts | f | g | 'a' | ts | f | g |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
|
|
c |
|
|
======
|
|
a |
|
|
a |
|
|
a |
|
|
a |
|
|
|
|
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
|
|
ts1 |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' | ts | f | g |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a | 2025-10-22 00:00:01.000 | 102 | 1012 |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select a.* from (select today 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 |
|
|
__tomorrow__ 00:00:00.000 | 103 | 1013 |
|
|
__tomorrow__ 00:00:02.000 | 104 | 1014 |
|
|
|
|
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:01.000 | 302 | 3012 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
|
|
2025-10-22 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
|
|
|
|
taos> select b.c from (select today 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 today 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 |
|
|
__tomorrow__ 00:00:00.000 |
|
|
__tomorrow__ 00:00:02.000 |
|
|
|
|
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' | ts | f | g |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
c |
|
|
======
|
|
a |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
ts1 | ts | f | g | 'a' | ts | f | g |
|
|
============================================================================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a | 2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
ts | f | g |
|
|
======================================================
|
|
2025-10-22 00:00:00.000 | 101 | 1011 |
|
|
|
|
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
ts1 | ts | f | g | 'a' |
|
|
======================================================================================
|
|
2025-10-22 00:00:00.000 | 2025-10-22 00:00:00.000 | 301 | 3011 | a |
|
|
|
|
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
c |
|
|
======
|
|
a |
|
|
|
|
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
|
|
ts |
|
|
==========================
|
|
2025-10-22 00:00:00.000 |
|
|
|
|
taos> select * from (select today 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 today 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 today 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;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-22 00:00:00.000 | 301 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 302 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 303 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 304 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 401 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 402 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 403 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 404 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
|
|
taos> select * from (select today 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=today order by tb.val;
|
|
ts | val | tg2 | ts | val | tg2 |
|
|
============================================================================================================
|
|
2025-10-22 00:00:00.000 | 301 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 302 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 303 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 304 | 1 | 2025-10-22 00:00:00.000 | 101 | 1 |
|
|
2025-10-22 00:00:00.000 | 401 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 402 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 403 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
2025-10-22 00:00:00.000 | 404 | 2 | 2025-10-22 00:00:00.000 | 201 | 2 |
|
|
|
|
taos> select * from (select today 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>today ;
|
|
|