enh: add more cases

This commit is contained in:
dapan1121 2025-03-12 11:04:54 +08:00
parent ad4b278162
commit 88fe9fc584
4 changed files with 1371 additions and 9 deletions

View File

@ -0,0 +1,641 @@
taos> use test;
Database changed.
taos> select * from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | ts | f | g | 'a' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
taos> select * from a1 a left join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select b.* from a1 a left join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select a.*, b.ts from a1 a left join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts |
================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:02.000 |
__today__ 00:00:01.000 | 102 | 1012 | NULL |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL |
taos> select b.c from a1 a left join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select * from a1 a left 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
taos> select b.c from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
taos> select * from a1 a left 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 |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a left join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
NULL | __today__ 00:00:01.000 |
NULL | __tomorrow__ 00:00:00.000 |
NULL | __tomorrow__ 00:00:02.000 |
taos> select * from a1 a left 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a left 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 left join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a left 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left 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 |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
taos> select b.c from a1 a left 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 |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select * from a1 a left 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left 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 |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
taos> select b.c from a1 a left 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 |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 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 left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 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 left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
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 left 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
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 left 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 left 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 ta.ts, ta.val, tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
__today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
__today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 left 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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 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 left 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 left 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:02.000 | 104 | 1 | NULL | NULL | NULL |
__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 left join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select * from (select today as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from (select today as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts, f, g, 'a' c from b1) b left 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 left join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 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 left 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 left join a1 a on b.ts1 = a.ts;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 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 left join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 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 left 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 left join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 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 left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 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 left join a1 a on b.ts1 = a.ts and 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 left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 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 left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 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 left join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb left 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__today__ 00:00:00.000 | 404 | 1 | NULL | NULL | NULL |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb left 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 304 | 1 | NULL | NULL | NULL |
__today__ 00:00:00.000 | 404 | 2 | NULL | NULL | NULL |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb left 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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 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 left 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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 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 left 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;
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
4 ts | f | g | ts | f | g | 'a' |
5 ==================================================================================================================
6 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
7 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
8 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
9 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
10 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
11 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
12 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
13 taos> select * from a1 a left join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
14 ts | f | g | ts1 | f | g | 'a' |
15 ==================================================================================================================
16 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
17 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
18 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
19 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
20 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
21 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
22 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
23 taos> select a.* from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
24 ts | f | g |
25 ======================================================
26 __today__ 00:00:00.000 | 101 | 1011 |
27 __today__ 00:00:00.000 | 101 | 1011 |
28 __today__ 00:00:00.000 | 101 | 1011 |
29 __today__ 00:00:00.000 | 101 | 1011 |
30 __today__ 00:00:01.000 | 102 | 1012 |
31 __tomorrow__ 00:00:00.000 | 103 | 1013 |
32 __tomorrow__ 00:00:02.000 | 104 | 1014 |
33 taos> select b.* from a1 a left join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
34 ts | f | g | 'a' |
35 ============================================================
36 __today__ 00:00:00.000 | 301 | 3011 | a |
37 __today__ 00:00:00.000 | 302 | 3012 | a |
38 __today__ 00:00:00.000 | 303 | 3013 | a |
39 __today__ 00:00:00.000 | 304 | 3014 | a |
40 NULL | NULL | NULL | NU. |
41 NULL | NULL | NULL | NU. |
42 NULL | NULL | NULL | NU. |
43 taos> select b.* from a1 a left join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
44 ts1 | f | g | 'a' |
45 ============================================================
46 __today__ 00:00:00.000 | 301 | 3011 | a |
47 __today__ 00:00:00.000 | 302 | 3012 | a |
48 __today__ 00:00:00.000 | 303 | 3013 | a |
49 __today__ 00:00:00.000 | 304 | 3014 | a |
50 NULL | NULL | NULL | NU. |
51 NULL | NULL | NULL | NU. |
52 NULL | NULL | NULL | NU. |
53 taos> select a.*, b.ts from a1 a left join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
54 ts | f | g | ts |
55 ================================================================================
56 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
57 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
58 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
59 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:02.000 |
60 __today__ 00:00:01.000 | 102 | 1012 | NULL |
61 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL |
62 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL |
63 taos> select b.c from a1 a left join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
64 c |
65 ======
66 a |
67 a |
68 a |
69 a |
70 NU. |
71 NU. |
72 NU. |
73 taos> select b.ts from a1 a left join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
74 ts |
75 ==========================
76 __today__ 00:00:00.000 |
77 __today__ 00:00:00.000 |
78 __today__ 00:00:00.000 |
79 __today__ 00:00:00.000 |
80 NULL |
81 NULL |
82 NULL |
83 taos> select * from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
84 ts | f | g | ts1 | ts | f | g | 'a' |
85 ============================================================================================================================================
86 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
87 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
88 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
89 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
90 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
91 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
92 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
93 taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
94 ts | f | g |
95 ======================================================
96 __today__ 00:00:00.000 | 101 | 1011 |
97 __today__ 00:00:00.000 | 101 | 1011 |
98 __today__ 00:00:00.000 | 101 | 1011 |
99 __today__ 00:00:00.000 | 101 | 1011 |
100 __today__ 00:00:01.000 | 102 | 1012 |
101 __tomorrow__ 00:00:00.000 | 103 | 1013 |
102 __tomorrow__ 00:00:02.000 | 104 | 1014 |
103 taos> select b.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
104 ts1 | ts | f | g | 'a' |
105 ======================================================================================
106 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
107 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
108 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
109 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
110 NULL | NULL | NULL | NULL | NU. |
111 NULL | NULL | NULL | NULL | NU. |
112 NULL | NULL | NULL | NULL | NU. |
113 taos> select b.c from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
114 c |
115 ======
116 a |
117 a |
118 a |
119 a |
120 NU. |
121 NU. |
122 NU. |
123 taos> select * from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
124 ts | f | g | ts1 | ts | f | g | c |
125 ============================================================================================================================================
126 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
127 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
128 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
129 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
130 taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
131 ts | f | g |
132 ======================================================
133 __today__ 00:00:00.000 | 101 | 1011 |
134 __today__ 00:00:01.000 | 102 | 1012 |
135 __tomorrow__ 00:00:00.000 | 103 | 1013 |
136 __tomorrow__ 00:00:02.000 | 104 | 1014 |
137 taos> select b.* from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
138 ts1 | ts | f | g | c |
139 ======================================================================================
140 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
141 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
142 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
143 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
144 taos> select b.ts1,a.ts from a1 a left join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
145 ts1 | ts |
146 ====================================================
147 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
148 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
149 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
150 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
151 NULL | __today__ 00:00:01.000 |
152 NULL | __tomorrow__ 00:00:00.000 |
153 NULL | __tomorrow__ 00:00:02.000 |
154 taos> select * from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
155 ts | f | g | ts1 | ts | f | g | 'a' |
156 ============================================================================================================================================
157 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
158 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
159 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
160 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
161 taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
162 ts | f | g |
163 ======================================================
164 __today__ 00:00:00.000 | 101 | 1011 |
165 __today__ 00:00:01.000 | 102 | 1012 |
166 __tomorrow__ 00:00:00.000 | 103 | 1013 |
167 __tomorrow__ 00:00:02.000 | 104 | 1014 |
168 taos> select b.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
169 ts1 | ts | f | g | 'a' |
170 ======================================================================================
171 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
172 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
173 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
174 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
175 taos> select b.c from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
176 c |
177 ======
178 a |
179 a |
180 a |
181 a |
182 taos> select b.ts from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
183 ts |
184 ==========================
185 __today__ 00:00:00.000 |
186 __today__ 00:00:01.000 |
187 __tomorrow__ 00:00:00.000 |
188 __tomorrow__ 00:00:02.000 |
189 taos> select * from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
190 ts | f | g | ts1 | ts | f | g | 'a' |
191 ============================================================================================================================================
192 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
193 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
194 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
195 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
196 taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
197 ts | f | g |
198 ======================================================
199 __today__ 00:00:00.000 | 101 | 1011 |
200 __today__ 00:00:01.000 | 102 | 1012 |
201 __tomorrow__ 00:00:00.000 | 103 | 1013 |
202 __tomorrow__ 00:00:02.000 | 104 | 1014 |
203 taos> select b.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
204 ts1 | ts | f | g | 'a' |
205 ======================================================================================
206 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
207 NULL | NULL | NULL | NULL | NU. |
208 NULL | NULL | NULL | NULL | NU. |
209 NULL | NULL | NULL | NULL | NU. |
210 taos> select b.c from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
211 c |
212 ======
213 a |
214 NU. |
215 NU. |
216 NU. |
217 taos> select b.ts from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
218 ts |
219 ==========================
220 __today__ 00:00:00.000 |
221 NULL |
222 NULL |
223 NULL |
224 taos> select * from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
225 ts | f | g | ts1 | ts | f | g | 'a' |
226 ============================================================================================================================================
227 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
228 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
229 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
230 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
231 taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
232 ts | f | g |
233 ======================================================
234 __today__ 00:00:00.000 | 101 | 1011 |
235 __today__ 00:00:01.000 | 102 | 1012 |
236 __tomorrow__ 00:00:00.000 | 103 | 1013 |
237 __tomorrow__ 00:00:02.000 | 104 | 1014 |
238 taos> select b.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
239 ts1 | ts | f | g | 'a' |
240 ======================================================================================
241 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
242 NULL | NULL | NULL | NULL | NU. |
243 NULL | NULL | NULL | NULL | NU. |
244 NULL | NULL | NULL | NULL | NU. |
245 taos> select b.c from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
246 c |
247 ======
248 a |
249 NU. |
250 NU. |
251 NU. |
252 taos> select b.ts from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
253 ts |
254 ==========================
255 __today__ 00:00:00.000 |
256 NULL |
257 NULL |
258 NULL |
259 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
260 ts |
261 ==========================
262 __today__ 00:00:00.000 |
263 NULL |
264 NULL |
265 NULL |
266 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
267 ts |
268 ==========================
269 __today__ 00:00:00.000 |
270 __today__ 00:00:01.000 |
271 __tomorrow__ 00:00:00.000 |
272 __tomorrow__ 00:00:02.000 |
273 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
274 ts |
275 ==========================
276 __today__ 00:00:00.000 |
277 NULL |
278 NULL |
279 NULL |
280 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
281 ts |
282 ==========================
283 __today__ 00:00:00.000 |
284 __today__ 00:00:01.000 |
285 __tomorrow__ 00:00:00.000 |
286 __tomorrow__ 00:00:02.000 |
287 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
288 ts |
289 ==========================
290 __today__ 00:00:00.000 |
291 NULL |
292 NULL |
293 NULL |
294 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
295 ts |
296 ==========================
297 NULL |
298 NULL |
299 NULL |
300 NULL |
301 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 left 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;
302 ts | val | tg1 | ts | val | tg1 |
303 ============================================================================================================
304 __tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
305 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 left 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;
306 ts | val | tg2 | ts | val | tg2 |
307 ============================================================================================================
308 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
309 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
310 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 left 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 ta.ts, ta.val, tb.val;
311 ts | val | tg2 | ts | val | tg2 |
312 ============================================================================================================
313 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
314 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
315 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
316 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
317 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
318 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
319 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
320 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
321 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
322 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
323 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
324 __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
325 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
326 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
327 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 left 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;
328 ts | val | tg2 | ts | val | tg2 |
329 ============================================================================================================
330 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
331 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
332 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
333 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
334 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
335 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
336 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
337 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
338 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 left 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;
339 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 left 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;
340 ts | val | tg2 | ts | val | tg2 |
341 ============================================================================================================
342 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
343 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
344 taos> select * from (select today as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
345 ts | f | g | 'a' | ts | f | g |
346 ==================================================================================================================
347 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
348 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
349 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
350 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
351 taos> select * from (select today as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
352 ts1 | f | g | 'a' | ts | f | g |
353 ==================================================================================================================
354 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
355 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
356 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
357 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
358 taos> select a.* from (select today as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
359 ts | f | g |
360 ======================================================
361 __today__ 00:00:00.000 | 101 | 1011 |
362 __today__ 00:00:00.000 | 101 | 1011 |
363 __today__ 00:00:00.000 | 101 | 1011 |
364 __today__ 00:00:00.000 | 101 | 1011 |
365 taos> select b.* from (select today as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
366 ts | f | g | 'a' |
367 ============================================================
368 __today__ 00:00:00.000 | 301 | 3011 | a |
369 __today__ 00:00:00.000 | 302 | 3012 | a |
370 __today__ 00:00:00.000 | 303 | 3013 | a |
371 __today__ 00:00:00.000 | 304 | 3014 | a |
372 taos> select b.* from (select today as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
373 ts1 | f | g | 'a' |
374 ============================================================
375 __today__ 00:00:00.000 | 301 | 3011 | a |
376 __today__ 00:00:00.000 | 302 | 3012 | a |
377 __today__ 00:00:00.000 | 303 | 3013 | a |
378 __today__ 00:00:00.000 | 304 | 3014 | a |
379 taos> select b.c from (select today as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
380 c |
381 ======
382 a |
383 a |
384 a |
385 a |
386 taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
387 ts |
388 ==========================
389 __today__ 00:00:00.000 |
390 __today__ 00:00:00.000 |
391 __today__ 00:00:00.000 |
392 __today__ 00:00:00.000 |
393 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
394 ts1 | ts | f | g | 'a' | ts | f | g |
395 ============================================================================================================================================
396 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
397 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
398 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
399 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
400 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
401 ts | f | g |
402 ======================================================
403 __today__ 00:00:00.000 | 101 | 1011 |
404 __today__ 00:00:00.000 | 101 | 1011 |
405 __today__ 00:00:00.000 | 101 | 1011 |
406 __today__ 00:00:00.000 | 101 | 1011 |
407 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
408 ts1 | ts | f | g | 'a' |
409 ======================================================================================
410 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
411 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
412 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
413 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
414 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
415 c |
416 ======
417 a |
418 a |
419 a |
420 a |
421 taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
422 ts1 |
423 ==========================
424 __today__ 00:00:00.000 |
425 __today__ 00:00:00.000 |
426 __today__ 00:00:00.000 |
427 __today__ 00:00:00.000 |
428 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
429 ts1 | ts | f | g | 'a' | ts | f | g |
430 ============================================================================================================================================
431 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
432 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
433 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
434 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
435 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
436 ts | f | g |
437 ======================================================
438 __today__ 00:00:00.000 | 101 | 1011 |
439 __today__ 00:00:01.000 | 102 | 1012 |
440 __tomorrow__ 00:00:00.000 | 103 | 1013 |
441 __tomorrow__ 00:00:02.000 | 104 | 1014 |
442 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
443 ts1 | ts | f | g | 'a' |
444 ======================================================================================
445 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
446 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
447 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
448 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
449 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
450 c |
451 ======
452 a |
453 a |
454 a |
455 a |
456 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
457 ts |
458 ==========================
459 __today__ 00:00:00.000 |
460 __today__ 00:00:01.000 |
461 __tomorrow__ 00:00:00.000 |
462 __tomorrow__ 00:00:02.000 |
463 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
464 ts1 | ts | f | g | 'a' | ts | f | g |
465 ============================================================================================================================================
466 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
467 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
468 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
469 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
470 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
471 ts | f | g |
472 ======================================================
473 __today__ 00:00:00.000 | 101 | 1011 |
474 NULL | NULL | NULL |
475 NULL | NULL | NULL |
476 NULL | NULL | NULL |
477 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
478 ts1 | ts | f | g | 'a' |
479 ======================================================================================
480 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
481 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
482 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
483 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
484 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
485 c |
486 ======
487 a |
488 a |
489 a |
490 a |
491 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
492 ts |
493 ==========================
494 __today__ 00:00:00.000 |
495 __today__ 00:00:01.000 |
496 __tomorrow__ 00:00:00.000 |
497 __tomorrow__ 00:00:02.000 |
498 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
499 ts1 | ts | f | g | 'a' | ts | f | g |
500 ============================================================================================================================================
501 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
502 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
503 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
504 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
505 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
506 ts | f | g |
507 ======================================================
508 __today__ 00:00:00.000 | 101 | 1011 |
509 NULL | NULL | NULL |
510 NULL | NULL | NULL |
511 NULL | NULL | NULL |
512 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
513 ts1 | ts | f | g | 'a' |
514 ======================================================================================
515 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
516 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
517 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
518 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
519 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
520 c |
521 ======
522 a |
523 a |
524 a |
525 a |
526 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
527 ts |
528 ==========================
529 __today__ 00:00:00.000 |
530 __today__ 00:00:01.000 |
531 __tomorrow__ 00:00:00.000 |
532 __tomorrow__ 00:00:02.000 |
533 taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb left 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;
534 ts | val | tg1 | ts | val | tg1 |
535 ============================================================================================================
536 __today__ 00:00:00.000 | 404 | 1 | NULL | NULL | NULL |
537 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb left 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;
538 ts | val | tg2 | ts | val | tg2 |
539 ============================================================================================================
540 __today__ 00:00:00.000 | 304 | 1 | NULL | NULL | NULL |
541 __today__ 00:00:00.000 | 404 | 2 | NULL | NULL | NULL |
542 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb left 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;;
543 ts | val | tg2 | ts | val | tg2 |
544 ============================================================================================================
545 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
546 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
547 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
548 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
549 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
550 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
551 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
552 __today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
553 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 left 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;
554 ts | val | tg2 | ts | val | tg2 |
555 ============================================================================================================
556 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
557 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
558 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
559 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
560 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
561 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
562 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
563 __today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
564 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 left 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;

View File

@ -0,0 +1,79 @@
use test;
select * from a1 a right join (select __today__ as ts, f, g, 'a' from b1) b on a.ts = b.ts;
select * from a1 a right join (select __today__ as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
select a.* from a1 a right join (select __today__ as ts, f, g, 'a' from b1) b on a.ts = b.ts;
select b.* from a1 a right join (select __today__ as ts, f, g, 'a' from b1) b on a.ts = b.ts;
select b.* from a1 a right join (select __today__ as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
select a.*, b.ts from a1 a right join (select __today__ as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
select b.c from a1 a right join (select __today__ as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
select b.ts from a1 a right join (select __today__ as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
select * from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
select a.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
select b.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
select b.c from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
select * from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
select a.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
select b.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
select b.ts1,a.ts from a1 a right join (select __today__ as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
select * from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
select a.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
select b.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
select b.c from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
select b.ts from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
select * from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
select a.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
select b.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
select b.c from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
select b.ts from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
select * from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
select a.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
select b.* from a1 a right join (select __today__ as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
select b.c from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
select b.ts from a1 a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1 order by f) a right join (select __today__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from a1) a right join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta right 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;
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta right 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;
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 right 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 ta.ts, ta.val, tb.val;
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 right 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;
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 right 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__;
select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta right 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;
select * from (select __today__ as ts, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts;
select * from (select __today__ as ts1, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts1;
select a.* from (select __today__ as ts, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts;
select b.* from (select __today__ as ts, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts;
select b.* from (select __today__ as ts1, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts1;
select b.c from (select __today__ as ts, f, g, 'a' c from b1) b right join a1 a on a.ts = b.ts;
select b.ts from (select __today__ as ts, f, g, 'a' c from b1) b right join a1 a on a.ts = b.ts;
select * from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts1 = a.ts;
select a.* from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts1 = a.ts;
select b.* from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts1 = a.ts;
select b.c from (select __today__ as ts1, ts, f, g, 'a' c from b1) b right join a1 a on b.ts1 = a.ts;
select b.ts1 from (select __today__ as ts1, f, g, 'a' c from b1) b right join a1 a on b.ts1 = a.ts;
select * from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts;
select a.* from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts;
select b.* from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts;
select b.c from (select __today__ as ts1, ts, f, g, 'a' c from b1) b right join a1 a on a.ts = b.ts;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from b1) b right join a1 a on a.ts = b.ts;
select * from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts1 = a.ts and a.ts = b.ts;
select a.* from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts1 = a.ts and a.ts = b.ts;
select b.* from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts1 = a.ts and a.ts = b.ts;
select b.c from (select __today__ as ts1, ts, f, g, 'a' c from b1) b right join a1 a on b.ts1 = a.ts and a.ts = b.ts;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from b1) b right join a1 a on b.ts1 = a.ts and a.ts = b.ts;
select * from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts = a.ts and a.ts = b.ts1;
select a.* from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts = a.ts and a.ts = b.ts1;
select b.* from (select __today__ as ts1, ts, f, g, 'a' from b1) b right join a1 a on b.ts = a.ts and a.ts = b.ts1;
select b.c from (select __today__ as ts1, ts, f, g, 'a' c from b1) b right join a1 a on b.ts = a.ts and a.ts = b.ts1;
select b.ts from (select __today__ as ts1, ts, f, g, 'a' c from b1) b right join a1 a on b.ts = a.ts and a.ts = b.ts1;
select * from (select __today__ ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb right 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;
select * from (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb right 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;
select * from (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb right 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;;
select * from (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb right 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;
select * from (select __today__ ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb right 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__;

View File

@ -0,0 +1,641 @@
taos> use test;
Database changed.
taos> select * from a1 a left join (select today() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | ts | f | g | 'a' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
taos> select * from a1 a left join (select today() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select today() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join (select today() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select b.* from a1 a left join (select today() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select a.*, b.ts from a1 a left join (select today() as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts |
================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:02.000 |
__today__ 00:00:01.000 | 102 | 1012 | NULL |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL |
taos> select b.c from a1 a left join (select today() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select today() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select * from a1 a left 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
taos> select b.c from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
taos> select * from a1 a left 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 |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a left join (select today() as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
NULL | __today__ 00:00:01.000 |
NULL | __tomorrow__ 00:00:00.000 |
NULL | __tomorrow__ 00:00:02.000 |
taos> select * from a1 a left 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join (select today() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a left 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 left join (select today() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a left 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left 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 |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
taos> select b.c from a1 a left 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 |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select * from a1 a left 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
__tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left 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 |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
taos> select b.c from a1 a left 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 |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 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 left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 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 left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
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 left 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
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 left 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 left 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 ta.ts, ta.val, tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
__today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
__today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
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 left 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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 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 left 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 left 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:02.000 | 104 | 1 | NULL | NULL | NULL |
__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 left join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select * from (select today() as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from (select today() as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select today() as ts, f, g, 'a' c from b1) b left 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 left join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 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 left 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 left join a1 a on b.ts1 = a.ts;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 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 left join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 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 left join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 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 left 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 left join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 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 left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 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 left join a1 a on b.ts1 = a.ts and 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 left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 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 left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 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 left join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select today() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb left 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__today__ 00:00:00.000 | 404 | 1 | NULL | NULL | NULL |
taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb left 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 304 | 1 | NULL | NULL | NULL |
__today__ 00:00:00.000 | 404 | 2 | NULL | NULL | NULL |
taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb left 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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 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 left 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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 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 left 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();
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a left join (select today() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
4 ts | f | g | ts | f | g | 'a' |
5 ==================================================================================================================
6 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
7 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
8 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
9 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
10 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
11 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
12 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
13 taos> select * from a1 a left join (select today() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
14 ts | f | g | ts1 | f | g | 'a' |
15 ==================================================================================================================
16 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
17 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
18 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
19 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
20 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
21 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
22 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
23 taos> select a.* from a1 a left join (select today() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
24 ts | f | g |
25 ======================================================
26 __today__ 00:00:00.000 | 101 | 1011 |
27 __today__ 00:00:00.000 | 101 | 1011 |
28 __today__ 00:00:00.000 | 101 | 1011 |
29 __today__ 00:00:00.000 | 101 | 1011 |
30 __today__ 00:00:01.000 | 102 | 1012 |
31 __tomorrow__ 00:00:00.000 | 103 | 1013 |
32 __tomorrow__ 00:00:02.000 | 104 | 1014 |
33 taos> select b.* from a1 a left join (select today() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
34 ts | f | g | 'a' |
35 ============================================================
36 __today__ 00:00:00.000 | 301 | 3011 | a |
37 __today__ 00:00:00.000 | 302 | 3012 | a |
38 __today__ 00:00:00.000 | 303 | 3013 | a |
39 __today__ 00:00:00.000 | 304 | 3014 | a |
40 NULL | NULL | NULL | NU. |
41 NULL | NULL | NULL | NU. |
42 NULL | NULL | NULL | NU. |
43 taos> select b.* from a1 a left join (select today() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
44 ts1 | f | g | 'a' |
45 ============================================================
46 __today__ 00:00:00.000 | 301 | 3011 | a |
47 __today__ 00:00:00.000 | 302 | 3012 | a |
48 __today__ 00:00:00.000 | 303 | 3013 | a |
49 __today__ 00:00:00.000 | 304 | 3014 | a |
50 NULL | NULL | NULL | NU. |
51 NULL | NULL | NULL | NU. |
52 NULL | NULL | NULL | NU. |
53 taos> select a.*, b.ts from a1 a left join (select today() as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
54 ts | f | g | ts |
55 ================================================================================
56 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
57 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
58 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
59 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:02.000 |
60 __today__ 00:00:01.000 | 102 | 1012 | NULL |
61 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL |
62 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL |
63 taos> select b.c from a1 a left join (select today() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
64 c |
65 ======
66 a |
67 a |
68 a |
69 a |
70 NU. |
71 NU. |
72 NU. |
73 taos> select b.ts from a1 a left join (select today() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
74 ts |
75 ==========================
76 __today__ 00:00:00.000 |
77 __today__ 00:00:00.000 |
78 __today__ 00:00:00.000 |
79 __today__ 00:00:00.000 |
80 NULL |
81 NULL |
82 NULL |
83 taos> select * from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
84 ts | f | g | ts1 | ts | f | g | 'a' |
85 ============================================================================================================================================
86 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
87 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
88 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
89 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
90 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
91 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
92 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
93 taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
94 ts | f | g |
95 ======================================================
96 __today__ 00:00:00.000 | 101 | 1011 |
97 __today__ 00:00:00.000 | 101 | 1011 |
98 __today__ 00:00:00.000 | 101 | 1011 |
99 __today__ 00:00:00.000 | 101 | 1011 |
100 __today__ 00:00:01.000 | 102 | 1012 |
101 __tomorrow__ 00:00:00.000 | 103 | 1013 |
102 __tomorrow__ 00:00:02.000 | 104 | 1014 |
103 taos> select b.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
104 ts1 | ts | f | g | 'a' |
105 ======================================================================================
106 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
107 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
108 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
109 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
110 NULL | NULL | NULL | NULL | NU. |
111 NULL | NULL | NULL | NULL | NU. |
112 NULL | NULL | NULL | NULL | NU. |
113 taos> select b.c from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
114 c |
115 ======
116 a |
117 a |
118 a |
119 a |
120 NU. |
121 NU. |
122 NU. |
123 taos> select * from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
124 ts | f | g | ts1 | ts | f | g | c |
125 ============================================================================================================================================
126 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
127 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
128 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
129 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
130 taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
131 ts | f | g |
132 ======================================================
133 __today__ 00:00:00.000 | 101 | 1011 |
134 __today__ 00:00:01.000 | 102 | 1012 |
135 __tomorrow__ 00:00:00.000 | 103 | 1013 |
136 __tomorrow__ 00:00:02.000 | 104 | 1014 |
137 taos> select b.* from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
138 ts1 | ts | f | g | c |
139 ======================================================================================
140 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
141 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
142 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
143 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
144 taos> select b.ts1,a.ts from a1 a left join (select today() as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
145 ts1 | ts |
146 ====================================================
147 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
148 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
149 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
150 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
151 NULL | __today__ 00:00:01.000 |
152 NULL | __tomorrow__ 00:00:00.000 |
153 NULL | __tomorrow__ 00:00:02.000 |
154 taos> select * from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
155 ts | f | g | ts1 | ts | f | g | 'a' |
156 ============================================================================================================================================
157 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
158 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
159 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
160 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
161 taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
162 ts | f | g |
163 ======================================================
164 __today__ 00:00:00.000 | 101 | 1011 |
165 __today__ 00:00:01.000 | 102 | 1012 |
166 __tomorrow__ 00:00:00.000 | 103 | 1013 |
167 __tomorrow__ 00:00:02.000 | 104 | 1014 |
168 taos> select b.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
169 ts1 | ts | f | g | 'a' |
170 ======================================================================================
171 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
172 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
173 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
174 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
175 taos> select b.c from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
176 c |
177 ======
178 a |
179 a |
180 a |
181 a |
182 taos> select b.ts from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
183 ts |
184 ==========================
185 __today__ 00:00:00.000 |
186 __today__ 00:00:01.000 |
187 __tomorrow__ 00:00:00.000 |
188 __tomorrow__ 00:00:02.000 |
189 taos> select * from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
190 ts | f | g | ts1 | ts | f | g | 'a' |
191 ============================================================================================================================================
192 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
193 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
194 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
195 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
196 taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
197 ts | f | g |
198 ======================================================
199 __today__ 00:00:00.000 | 101 | 1011 |
200 __today__ 00:00:01.000 | 102 | 1012 |
201 __tomorrow__ 00:00:00.000 | 103 | 1013 |
202 __tomorrow__ 00:00:02.000 | 104 | 1014 |
203 taos> select b.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
204 ts1 | ts | f | g | 'a' |
205 ======================================================================================
206 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
207 NULL | NULL | NULL | NULL | NU. |
208 NULL | NULL | NULL | NULL | NU. |
209 NULL | NULL | NULL | NULL | NU. |
210 taos> select b.c from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
211 c |
212 ======
213 a |
214 NU. |
215 NU. |
216 NU. |
217 taos> select b.ts from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
218 ts |
219 ==========================
220 __today__ 00:00:00.000 |
221 NULL |
222 NULL |
223 NULL |
224 taos> select * from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
225 ts | f | g | ts1 | ts | f | g | 'a' |
226 ============================================================================================================================================
227 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
228 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
229 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
230 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
231 taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
232 ts | f | g |
233 ======================================================
234 __today__ 00:00:00.000 | 101 | 1011 |
235 __today__ 00:00:01.000 | 102 | 1012 |
236 __tomorrow__ 00:00:00.000 | 103 | 1013 |
237 __tomorrow__ 00:00:02.000 | 104 | 1014 |
238 taos> select b.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
239 ts1 | ts | f | g | 'a' |
240 ======================================================================================
241 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
242 NULL | NULL | NULL | NULL | NU. |
243 NULL | NULL | NULL | NULL | NU. |
244 NULL | NULL | NULL | NULL | NU. |
245 taos> select b.c from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
246 c |
247 ======
248 a |
249 NU. |
250 NU. |
251 NU. |
252 taos> select b.ts from a1 a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
253 ts |
254 ==========================
255 __today__ 00:00:00.000 |
256 NULL |
257 NULL |
258 NULL |
259 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
260 ts |
261 ==========================
262 __today__ 00:00:00.000 |
263 NULL |
264 NULL |
265 NULL |
266 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
267 ts |
268 ==========================
269 __today__ 00:00:00.000 |
270 __today__ 00:00:01.000 |
271 __tomorrow__ 00:00:00.000 |
272 __tomorrow__ 00:00:02.000 |
273 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
274 ts |
275 ==========================
276 __today__ 00:00:00.000 |
277 NULL |
278 NULL |
279 NULL |
280 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
281 ts |
282 ==========================
283 __today__ 00:00:00.000 |
284 __today__ 00:00:01.000 |
285 __tomorrow__ 00:00:00.000 |
286 __tomorrow__ 00:00:02.000 |
287 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
288 ts |
289 ==========================
290 __today__ 00:00:00.000 |
291 NULL |
292 NULL |
293 NULL |
294 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
295 ts |
296 ==========================
297 NULL |
298 NULL |
299 NULL |
300 NULL |
301 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 left 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;
302 ts | val | tg1 | ts | val | tg1 |
303 ============================================================================================================
304 __tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
305 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 left 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;
306 ts | val | tg2 | ts | val | tg2 |
307 ============================================================================================================
308 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
309 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
310 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 left 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 ta.ts, ta.val, tb.val;
311 ts | val | tg2 | ts | val | tg2 |
312 ============================================================================================================
313 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
314 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
315 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
316 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
317 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
318 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
319 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
320 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
321 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
322 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
323 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
324 __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
325 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
326 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
327 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 left 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;
328 ts | val | tg2 | ts | val | tg2 |
329 ============================================================================================================
330 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
331 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
332 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
333 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
334 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
335 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
336 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
337 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
338 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 left 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();
339 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 left 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;
340 ts | val | tg2 | ts | val | tg2 |
341 ============================================================================================================
342 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
343 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
344 taos> select * from (select today() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
345 ts | f | g | 'a' | ts | f | g |
346 ==================================================================================================================
347 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
348 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
349 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
350 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
351 taos> select * from (select today() as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
352 ts1 | f | g | 'a' | ts | f | g |
353 ==================================================================================================================
354 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
355 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
356 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
357 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
358 taos> select a.* from (select today() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
359 ts | f | g |
360 ======================================================
361 __today__ 00:00:00.000 | 101 | 1011 |
362 __today__ 00:00:00.000 | 101 | 1011 |
363 __today__ 00:00:00.000 | 101 | 1011 |
364 __today__ 00:00:00.000 | 101 | 1011 |
365 taos> select b.* from (select today() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
366 ts | f | g | 'a' |
367 ============================================================
368 __today__ 00:00:00.000 | 301 | 3011 | a |
369 __today__ 00:00:00.000 | 302 | 3012 | a |
370 __today__ 00:00:00.000 | 303 | 3013 | a |
371 __today__ 00:00:00.000 | 304 | 3014 | a |
372 taos> select b.* from (select today() as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
373 ts1 | f | g | 'a' |
374 ============================================================
375 __today__ 00:00:00.000 | 301 | 3011 | a |
376 __today__ 00:00:00.000 | 302 | 3012 | a |
377 __today__ 00:00:00.000 | 303 | 3013 | a |
378 __today__ 00:00:00.000 | 304 | 3014 | a |
379 taos> select b.c from (select today() as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
380 c |
381 ======
382 a |
383 a |
384 a |
385 a |
386 taos> select b.ts from (select today() as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
387 ts |
388 ==========================
389 __today__ 00:00:00.000 |
390 __today__ 00:00:00.000 |
391 __today__ 00:00:00.000 |
392 __today__ 00:00:00.000 |
393 taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
394 ts1 | ts | f | g | 'a' | ts | f | g |
395 ============================================================================================================================================
396 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
397 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
398 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
399 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
400 taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
401 ts | f | g |
402 ======================================================
403 __today__ 00:00:00.000 | 101 | 1011 |
404 __today__ 00:00:00.000 | 101 | 1011 |
405 __today__ 00:00:00.000 | 101 | 1011 |
406 __today__ 00:00:00.000 | 101 | 1011 |
407 taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
408 ts1 | ts | f | g | 'a' |
409 ======================================================================================
410 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
411 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
412 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
413 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
414 taos> select b.c from (select today() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
415 c |
416 ======
417 a |
418 a |
419 a |
420 a |
421 taos> select b.ts1 from (select today() as ts1, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
422 ts1 |
423 ==========================
424 __today__ 00:00:00.000 |
425 __today__ 00:00:00.000 |
426 __today__ 00:00:00.000 |
427 __today__ 00:00:00.000 |
428 taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
429 ts1 | ts | f | g | 'a' | ts | f | g |
430 ============================================================================================================================================
431 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
432 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
433 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
434 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
435 taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
436 ts | f | g |
437 ======================================================
438 __today__ 00:00:00.000 | 101 | 1011 |
439 __today__ 00:00:01.000 | 102 | 1012 |
440 __tomorrow__ 00:00:00.000 | 103 | 1013 |
441 __tomorrow__ 00:00:02.000 | 104 | 1014 |
442 taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
443 ts1 | ts | f | g | 'a' |
444 ======================================================================================
445 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
446 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
447 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
448 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
449 taos> select b.c from (select today() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
450 c |
451 ======
452 a |
453 a |
454 a |
455 a |
456 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
457 ts |
458 ==========================
459 __today__ 00:00:00.000 |
460 __today__ 00:00:01.000 |
461 __tomorrow__ 00:00:00.000 |
462 __tomorrow__ 00:00:02.000 |
463 taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
464 ts1 | ts | f | g | 'a' | ts | f | g |
465 ============================================================================================================================================
466 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
467 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
468 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
469 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
470 taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
471 ts | f | g |
472 ======================================================
473 __today__ 00:00:00.000 | 101 | 1011 |
474 NULL | NULL | NULL |
475 NULL | NULL | NULL |
476 NULL | NULL | NULL |
477 taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
478 ts1 | ts | f | g | 'a' |
479 ======================================================================================
480 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
481 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
482 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
483 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
484 taos> select b.c from (select today() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
485 c |
486 ======
487 a |
488 a |
489 a |
490 a |
491 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
492 ts |
493 ==========================
494 __today__ 00:00:00.000 |
495 __today__ 00:00:01.000 |
496 __tomorrow__ 00:00:00.000 |
497 __tomorrow__ 00:00:02.000 |
498 taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
499 ts1 | ts | f | g | 'a' | ts | f | g |
500 ============================================================================================================================================
501 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
502 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
503 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
504 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
505 taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
506 ts | f | g |
507 ======================================================
508 __today__ 00:00:00.000 | 101 | 1011 |
509 NULL | NULL | NULL |
510 NULL | NULL | NULL |
511 NULL | NULL | NULL |
512 taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
513 ts1 | ts | f | g | 'a' |
514 ======================================================================================
515 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
516 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
517 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
518 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
519 taos> select b.c from (select today() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
520 c |
521 ======
522 a |
523 a |
524 a |
525 a |
526 taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
527 ts |
528 ==========================
529 __today__ 00:00:00.000 |
530 __today__ 00:00:01.000 |
531 __tomorrow__ 00:00:00.000 |
532 __tomorrow__ 00:00:02.000 |
533 taos> select * from (select today() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb left 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;
534 ts | val | tg1 | ts | val | tg1 |
535 ============================================================================================================
536 __today__ 00:00:00.000 | 404 | 1 | NULL | NULL | NULL |
537 taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb left 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;
538 ts | val | tg2 | ts | val | tg2 |
539 ============================================================================================================
540 __today__ 00:00:00.000 | 304 | 1 | NULL | NULL | NULL |
541 __today__ 00:00:00.000 | 404 | 2 | NULL | NULL | NULL |
542 taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb left 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;;
543 ts | val | tg2 | ts | val | tg2 |
544 ============================================================================================================
545 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
546 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
547 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
548 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
549 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
550 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
551 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
552 __today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
553 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 left 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;
554 ts | val | tg2 | ts | val | tg2 |
555 ============================================================================================================
556 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
557 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
558 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
559 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
560 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
561 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
562 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
563 __today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
564 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 left 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();

View File

@ -170,18 +170,19 @@ class TDTestCase(TBase):
self.insert_data()
#self.test_today_case("inner")
#self.test_now_case("inner")
#self.test_constts_case("inner")
self.test_today_case("inner")
self.test_now_case("inner")
self.test_constts_case("inner")
#self.test_today_case("left_outer")
#self.test_now_case("left_outer")
self.test_today_case("left_outer")
self.test_now_case("left_outer")
#self.test_today_case("right_outer")
#self.test_today_case("full_outer")
#self.test_today_case("left_semi")
#self.test_today_case("left_anti")
self.test_today_case("full_outer")
self.test_today_case("left_semi")
self.test_today_case("left_anti")
#self.test_abnormal_case()
self.test_abnormal_case()
tdLog.success(f"{__file__} successfully executed")