enh: add right join cases

This commit is contained in:
dapan1121 2025-03-12 16:59:07 +08:00
parent d997c144a1
commit 7769bc3d19
4 changed files with 466 additions and 472 deletions

View File

@ -2,139 +2,103 @@
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;
taos> select * from a1 a right 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;
taos> select * from a1 a right 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;
taos> select a.* from a1 a right 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;
taos> select b.* from a1 a right 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;
taos> select b.* from a1 a right 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;
taos> 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;
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;
taos> select b.c from a1 a right 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;
taos> select b.ts from a1 a right 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;
taos> select * from a1 a right 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;
taos> select a.* from a1 a right 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;
taos> select b.* from a1 a right 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;
taos> 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;
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;
taos> select * from a1 a right 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 |
@ -142,7 +106,7 @@ taos> select * from a1 a left join (select today as ts1, ts, f, g, 'a' c from b1
__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;
taos> select a.* from a1 a right 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 |
@ -150,7 +114,7 @@ taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' c from
__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;
taos> select b.* from a1 a right 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 |
@ -158,18 +122,15 @@ taos> select b.* from a1 a left join (select today as ts1, ts, f, g, 'a' c from
__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;
taos> 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;
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;
taos> select * from a1 a right 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 |
@ -177,7 +138,7 @@ taos> select * from a1 a left join (select today as ts1, ts, f, g, 'a' from b1)
__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;
taos> select a.* from a1 a right 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 |
@ -185,7 +146,7 @@ taos> select a.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1
__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;
taos> select b.* from a1 a right 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 |
@ -193,7 +154,7 @@ taos> select b.* from a1 a left join (select today as ts1, ts, f, g, 'a' from b1
__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;
taos> 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;
c |
======
a |
@ -201,7 +162,7 @@ taos> select b.c from a1 a left join (select today as ts1, ts, f, g, 'a' c from
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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
@ -209,95 +170,79 @@ taos> select b.ts from a1 a left join (select today as ts1, ts, f, g, 'a' c from
__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;
taos> 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;
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. |
NULL | NULL | NULL | __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 |
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;
taos> 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;
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 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
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;
taos> 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;
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. |
__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 b.ts1 = a.ts and a.ts = b.ts;
taos> 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;
c |
======
a |
NU. |
NU. |
NU. |
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 b.ts1 = a.ts and a.ts = b.ts;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
__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.ts = a.ts and a.ts = b.ts1;
taos> 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;
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. |
NULL | NULL | NULL | __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 |
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;
taos> 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;
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 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
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;
taos> 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;
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. |
__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 b.ts = a.ts and a.ts = b.ts1;
taos> 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;
c |
======
a |
NU. |
NU. |
NU. |
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 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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
@ -305,15 +250,7 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a left joi
__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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
@ -321,52 +258,58 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f)
__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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
__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) 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;
taos> 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;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta 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;
taos> 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;
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 right 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 |
__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) 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;
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 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
NULL | NULL | NULL | __today__ 00:00:00.000 | 404 | 1 |
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;
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 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;
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 |
NULL | NULL | NULL | __today__ 00:00:00.000 | 304 | 1 |
NULL | NULL | NULL | __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) 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;
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
@ -378,111 +321,159 @@ taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where
__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;
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__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 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;
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 304 | 1 |
__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;
taos> select * from (select today as ts, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NU. | __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 |
taos> select * from (select today as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
taos> select * from (select today as ts1, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NU. | __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 |
taos> select a.* from (select today as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
taos> select a.* from (select today as ts, f, g, 'a' from b1) b right 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 |
__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 ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
taos> select b.* from (select today as ts, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select b.* from (select today as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
taos> select b.* from (select today as ts1, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
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;
taos> select b.c from (select today as ts, f, g, 'a' c from b1) b right join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
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;
taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b right 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 |
NULL |
NULL |
NULL |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NULL | NU. | __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 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b right 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 |
__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 b.ts1 = a.ts;
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
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;
taos> 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;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
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;
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b right 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 |
NULL |
NULL |
NULL |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b right 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 |
@ -490,7 +481,7 @@ taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b left join a1
__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;
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
@ -498,7 +489,7 @@ taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b left join a
__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;
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b right 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 |
@ -506,7 +497,7 @@ taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b left join 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;
taos> 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;
c |
======
a |
@ -514,7 +505,7 @@ taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b left join
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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
@ -522,98 +513,116 @@ taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b left joi
__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;
taos> 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;
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 |
NULL | NULL | NULL | NULL | NU. | __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 |
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;
taos> 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;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
__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 b.ts1 = a.ts and a.ts = b.ts;
taos> 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;
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 (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;
taos> 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;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
NULL |
NULL |
NULL |
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;
taos> 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;
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 |
NULL | NULL | NULL | NULL | NU. | __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 |
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;
taos> 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;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
__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 b.ts = a.ts and a.ts = b.ts1;
taos> 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;
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 (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;
taos> 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;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
NULL |
NULL |
NULL |
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;
taos> 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__today__ 00:00:00.000 | 404 | 1 | NULL | NULL | NULL |
NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 1 |
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;
taos> 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;
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 |
NULL | NULL | NULL | __tomorrow__ 00:00:02.000 | 104 | 1 |
NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 2 |
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;;
taos> 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 ta.val, 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 |
NULL | NULL | NULL | __today__ 00:00:01.000 | 102 | 1 |
NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 103 | 1 |
NULL | NULL | NULL | __tomorrow__ 00:00:02.000 | 104 | 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 |
NULL | NULL | NULL | __today__ 00:00:01.000 | 202 | 2 |
NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 203 | 2 |
NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
@ -625,17 +634,5 @@ taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 p
__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;
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 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;

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

View File

@ -72,7 +72,7 @@ select b.c from (select __today__ as ts1, ts, f, g, 'a' c from b1) b right join
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) 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 ta.val, 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

@ -2,139 +2,103 @@
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;
taos> select * from a1 a right 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;
taos> select * from a1 a right 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;
taos> select a.* from a1 a right 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;
taos> select b.* from a1 a right 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;
taos> select b.* from a1 a right 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;
taos> 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;
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;
taos> select b.c from a1 a right 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;
taos> select b.ts from a1 a right 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;
taos> select * from a1 a right 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;
taos> select a.* from a1 a right 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;
taos> select b.* from a1 a right 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;
taos> 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;
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;
taos> select * from a1 a right 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 |
@ -142,7 +106,7 @@ taos> select * from a1 a left join (select today() as ts1, ts, f, g, 'a' c from
__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;
taos> select a.* from a1 a right 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 |
@ -150,7 +114,7 @@ taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' c fro
__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;
taos> select b.* from a1 a right 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 |
@ -158,18 +122,15 @@ taos> select b.* from a1 a left join (select today() as ts1, ts, f, g, 'a' c fro
__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;
taos> 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;
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;
taos> select * from a1 a right 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 |
@ -177,7 +138,7 @@ taos> select * from a1 a left join (select today() as ts1, ts, f, g, 'a' from b1
__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;
taos> select a.* from a1 a right 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 |
@ -185,7 +146,7 @@ taos> select a.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from
__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;
taos> select b.* from a1 a right 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 |
@ -193,7 +154,7 @@ taos> select b.* from a1 a left join (select today() as ts1, ts, f, g, 'a' from
__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;
taos> 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;
c |
======
a |
@ -201,7 +162,7 @@ taos> select b.c from a1 a left join (select today() as ts1, ts, f, g, 'a' c fro
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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
@ -209,95 +170,79 @@ taos> select b.ts from a1 a left join (select today() as ts1, ts, f, g, 'a' c fr
__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;
taos> 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;
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. |
NULL | NULL | NULL | __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 |
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;
taos> 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;
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 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
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;
taos> 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;
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. |
__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 b.ts1 = a.ts and a.ts = b.ts;
taos> 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;
c |
======
a |
NU. |
NU. |
NU. |
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 b.ts1 = a.ts and a.ts = b.ts;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
__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.ts = a.ts and a.ts = b.ts1;
taos> 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;
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. |
NULL | NULL | NULL | __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 |
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;
taos> 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;
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 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
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;
taos> 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;
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. |
__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 b.ts = a.ts and a.ts = b.ts1;
taos> 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;
c |
======
a |
NU. |
NU. |
NU. |
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 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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
@ -305,15 +250,7 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1) a left j
__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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
@ -321,52 +258,58 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by
__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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
NULL |
NULL |
NULL |
__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) 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;
taos> 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;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta 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;
taos> 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;
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 right 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 |
__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) 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;
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 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
NULL | NULL | NULL | __today__ 00:00:00.000 | 404 | 1 |
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;
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 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;
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 |
NULL | NULL | NULL | __today__ 00:00:00.000 | 304 | 1 |
NULL | NULL | NULL | __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) 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;
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
@ -378,111 +321,159 @@ taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where
__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;
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__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 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();
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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 304 | 1 |
__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;
taos> select * from (select today() as ts, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NU. | __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 |
taos> select * from (select today() as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
taos> select * from (select today() as ts1, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NU. | __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 |
taos> select a.* from (select today() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
taos> select a.* from (select today() as ts, f, g, 'a' from b1) b right 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 |
__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 ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
taos> select b.* from (select today() as ts, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select b.* from (select today() as ts1, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts1;
taos> select b.* from (select today() as ts1, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
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;
taos> select b.c from (select today() as ts, f, g, 'a' c from b1) b right join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
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;
taos> select b.ts from (select today() as ts, f, g, 'a' c from b1) b right 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 |
NULL |
NULL |
NULL |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NULL | NU. | __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 |
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b right 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 |
__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 b.ts1 = a.ts;
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b right 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 |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NULL | NU. |
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;
taos> 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;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
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;
taos> select b.ts1 from (select today() as ts1, f, g, 'a' c from b1) b right 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 |
NULL |
NULL |
NULL |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b right 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 |
@ -490,7 +481,7 @@ taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b left join a
__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;
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b right join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
@ -498,7 +489,7 @@ taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join
__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;
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b right 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 |
@ -506,7 +497,7 @@ taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b left join
__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;
taos> 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;
c |
======
a |
@ -514,7 +505,7 @@ taos> select b.c from (select today() as ts1, ts, f, g, 'a' c from b1) b left jo
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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
@ -522,98 +513,116 @@ taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from b1) b left j
__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;
taos> 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;
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 |
NULL | NULL | NULL | NULL | NU. | __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 |
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;
taos> 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;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
__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 b.ts1 = a.ts and a.ts = b.ts;
taos> 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;
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 (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;
taos> 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;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
NULL |
NULL |
NULL |
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;
taos> 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;
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 |
NULL | NULL | NULL | NULL | NU. | __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 |
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;
taos> 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;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
__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 b.ts = a.ts and a.ts = b.ts1;
taos> 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;
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 (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;
taos> 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;
c |
======
a |
a |
a |
a |
NU. |
NU. |
NU. |
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;
taos> 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;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
NULL |
NULL |
NULL |
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;
taos> 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;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__today__ 00:00:00.000 | 404 | 1 | NULL | NULL | NULL |
NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 1 |
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;
taos> 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;
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 |
NULL | NULL | NULL | __tomorrow__ 00:00:02.000 | 104 | 1 |
NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 2 |
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;;
taos> 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 ta.val, 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 |
NULL | NULL | NULL | __today__ 00:00:01.000 | 102 | 1 |
NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 103 | 1 |
NULL | NULL | NULL | __tomorrow__ 00:00:02.000 | 104 | 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 |
NULL | NULL | NULL | __today__ 00:00:01.000 | 202 | 2 |
NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 203 | 2 |
NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 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 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;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
@ -625,17 +634,5 @@ taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0
__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();
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 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();

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

View File

@ -176,7 +176,7 @@ class TDTestCase(TBase):
self.test_today_case("left_outer")
self.test_now_case("left_outer")
#self.test_today_case("right_outer")
self.test_today_case("right_outer")
self.test_today_case("full_outer")
self.test_today_case("left_semi")