enh: add left join cases

This commit is contained in:
dapan1121 2025-03-11 11:29:49 +08:00
parent 364381c6f1
commit a4ed19b36d
13 changed files with 4136 additions and 159 deletions

View File

@ -915,6 +915,7 @@ int32_t taosGetErrSize();
#define TSDB_CODE_PAR_INVALID_COLS_SELECTFUNC TAOS_DEF_ERROR_CODE(0, 0x268A) #define TSDB_CODE_PAR_INVALID_COLS_SELECTFUNC TAOS_DEF_ERROR_CODE(0, 0x268A)
#define TSDB_CODE_PAR_INVALID_COLS_ALIAS TAOS_DEF_ERROR_CODE(0, 0x268B) #define TSDB_CODE_PAR_INVALID_COLS_ALIAS TAOS_DEF_ERROR_CODE(0, 0x268B)
#define TSDB_CODE_PAR_VALID_TS_SERIOUS_REQUIRED TAOS_DEF_ERROR_CODE(0, 0x268C) #define TSDB_CODE_PAR_VALID_TS_SERIOUS_REQUIRED TAOS_DEF_ERROR_CODE(0, 0x268C)
#define TSDB_CODE_PAR_PRIM_KEY_MUST_BE_TS TAOS_DEF_ERROR_CODE(0, 0x268D)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF) #define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner //planner

View File

@ -348,6 +348,8 @@ typedef struct SMJoinOperatorInfo {
#define PROBE_TS_NREACH(_asc, _pts, _bts) (((_asc) && (_pts) > (_bts)) || (!(_asc) && (_pts) < (_bts))) #define PROBE_TS_NREACH(_asc, _pts, _bts) (((_asc) && (_pts) > (_bts)) || (!(_asc) && (_pts) < (_bts)))
#define MJOIN_BUILD_BLK_OOR(_asc, _pts, _pidx, _bts, _bnum) (((_asc) && (*((int64_t*)(_pts) + (_pidx)) > *((int64_t*)(_bts) + (_bnum) - 1))) || ((!(_asc)) && (*((int64_t*)(_pts) + (_pidx)) < *((int64_t*)(_bts) + (_bnum) - 1)))) #define MJOIN_BUILD_BLK_OOR(_asc, _pts, _pidx, _bts, _bnum) (((_asc) && (*((int64_t*)(_pts) + (_pidx)) > *((int64_t*)(_bts) + (_bnum) - 1))) || ((!(_asc)) && (*((int64_t*)(_pts) + (_pidx)) < *((int64_t*)(_bts) + (_bnum) - 1))))
#define MJOIN_PRIM_EXPR_GOT(_pJoin) ((_pJoin)->probe->primCtx.type > 0 || (_pJoin)->build->primCtx.type > 0)
#define GRP_REMAIN_ROWS(_grp) ((_grp)->endIdx - (_grp)->readIdx + 1) #define GRP_REMAIN_ROWS(_grp) ((_grp)->endIdx - (_grp)->readIdx + 1)
#define GRP_DONE(_grp) ((_grp)->readIdx > (_grp)->endIdx) #define GRP_DONE(_grp) ((_grp)->readIdx > (_grp)->endIdx)

View File

@ -2696,11 +2696,9 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL
bool res = false; bool res = false;
SOperatorNode* pOp = (SOperatorNode*)pJoin->pPrimKeyEqCond; SOperatorNode* pOp = (SOperatorNode*)pJoin->pPrimKeyEqCond;
if (QUERY_NODE_VALUE == nodeType(pOp->pLeft) || QUERY_NODE_VALUE == nodeType(pOp->pRight)) {
return TSDB_CODE_SUCCESS;
}
if (QUERY_NODE_COLUMN != nodeType(pOp->pLeft) || QUERY_NODE_COLUMN != nodeType(pOp->pRight)) { if ((QUERY_NODE_COLUMN != nodeType(pOp->pLeft) && QUERY_NODE_VALUE != nodeType(pOp->pLeft)) ||
(QUERY_NODE_COLUMN != nodeType(pOp->pRight) && QUERY_NODE_VALUE != nodeType(pOp->pRight))) {
return TSDB_CODE_PLAN_INTERNAL_ERROR; return TSDB_CODE_PLAN_INTERNAL_ERROR;
} }
@ -2710,11 +2708,13 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL
if (TSDB_CODE_SUCCESS != code) { if (TSDB_CODE_SUCCESS != code) {
return code; return code;
} }
if (NULL !=
tSimpleHashGet(pTables, ((SColumnNode*)pOp->pLeft)->tableAlias, strlen(((SColumnNode*)pOp->pLeft)->tableAlias))) { char* opLeftTable = (QUERY_NODE_COLUMN == nodeType(pOp->pLeft)) ? ((SColumnNode*)pOp->pLeft)->tableAlias : ((SValueNode*)pOp->pLeft)->node.srcTable;
char* opRightTable = (QUERY_NODE_COLUMN == nodeType(pOp->pRight)) ? ((SColumnNode*)pOp->pRight)->tableAlias : ((SValueNode*)pOp->pRight)->node.srcTable;
if (NULL != tSimpleHashGet(pTables, opLeftTable, strlen(opLeftTable))) {
pOrderByNode = pOp->pLeft; pOrderByNode = pOp->pLeft;
} else if (NULL != tSimpleHashGet(pTables, ((SColumnNode*)pOp->pRight)->tableAlias, } else if (NULL != tSimpleHashGet(pTables, opRightTable, strlen(opRightTable))) {
strlen(((SColumnNode*)pOp->pRight)->tableAlias))) {
pOrderByNode = pOp->pRight; pOrderByNode = pOp->pRight;
} }
@ -2767,7 +2767,6 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL
} }
*pChildPos = (SNode*)pSort; *pChildPos = (SNode*)pSort;
pSort->node.pParent = (SLogicNode*)pJoin; pSort->node.pParent = (SLogicNode*)pJoin;
;
_return: _return:

View File

@ -1074,6 +1074,10 @@ static int32_t removePrimColFromJoinTargets(SNodeList* pTargets, SValueNode* pPr
static int32_t appendPrimColToJoinTargets(SSortMergeJoinPhysiNode* pJoin, SColumnNode** ppTarget, STargetNode* primExpr, int16_t blkId) { static int32_t appendPrimColToJoinTargets(SSortMergeJoinPhysiNode* pJoin, SColumnNode** ppTarget, STargetNode* primExpr, int16_t blkId) {
SColumnNode* pCol = *ppTarget; SColumnNode* pCol = *ppTarget;
if (TSDB_DATA_TYPE_TIMESTAMP != pCol->node.resType.type) {
planError("primary key output type is not ts, type:%d", pCol->node.resType.type);
return TSDB_CODE_PAR_PRIM_KEY_MUST_BE_TS;
}
pCol->dataBlockId = blkId; pCol->dataBlockId = blkId;
pCol->slotId = primExpr->slotId; pCol->slotId = primExpr->slotId;
int32_t code = nodesListMakeStrictAppend(&pJoin->pTargets, (SNode *)pCol); int32_t code = nodesListMakeStrictAppend(&pJoin->pTargets, (SNode *)pCol);

View File

@ -759,6 +759,7 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLS_FUNCTION, "Invalid cols functi
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLS_SELECTFUNC, "cols function's first param must be a select function that output a single row") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLS_SELECTFUNC, "cols function's first param must be a select function that output a single row")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLS_ALIAS, "Invalid using alias for cols function") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLS_ALIAS, "Invalid using alias for cols function")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALID_TS_SERIOUS_REQUIRED, "Valid time series required as input") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_VALID_TS_SERIOUS_REQUIRED, "Valid time series required as input")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PRIM_KEY_MUST_BE_TS, "Join primary key col must be timestmap type")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error") TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
//planner //planner

View File

@ -0,0 +1,969 @@
taos> use test;
Database changed.
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select a.*, b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g | ts1 | ts | f | g | c |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select timestamp "__today__ 00:00:00.000" 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 timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" 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 timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" 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 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__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 join (select timestamp "__today__ 00:00:00.000" 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=timestamp "__today__ 00:00:00.000" where tb.ts=timestamp "__today__ 00:00:00.000" order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select timestamp "__today__ 00:00:00.000" 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>timestamp "__today__ 00:00:00.000" where tb.ts>timestamp "__today__ 00:00:00.000";
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b 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 timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__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 timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__today__ 00:00:00.000" where tb.ts=timestamp "__today__ 00:00:00.000" 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 timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__today__ 00:00:00.000" where tb.ts>timestamp "__today__ 00:00:00.000";
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b where 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 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' from b1) b where 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 |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b where 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 a1 a , (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select b.ts1 from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where 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 |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where 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 |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where 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 |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where 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 timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where 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 timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__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 , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__today__ 00:00:00.000" order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__today__ 00:00:00.000" ;
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where 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 timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select b.ts1 from (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select timestamp "__today__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__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 timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__today__ 00:00:00.000" 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 timestamp "__today__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__today__ 00:00:00.000" ;
Can't render this file because it contains an unexpected character in line 5 and column 49.

View File

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

View File

@ -0,0 +1,969 @@
taos> use test;
Database changed.
taos> select * from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | ts | f | g | 'a' |
==================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select * from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select a.*, b.ts from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts |
================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:02.000 |
taos> select b.c from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select * from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select * from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" 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 | __tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 |
taos> select * from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" 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 | __tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" 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' |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select a.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select b.c from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select * from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" 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' |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select a.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select b.c from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select timestamp "__tomorrow__ 00:00:00.000" 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 timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" 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 timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 301 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 302 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 303 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 304 | 1 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 401 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 402 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 403 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select timestamp "__tomorrow__ 00:00:00.000" 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=timestamp "__tomorrow__ 00:00:00.000" where tb.ts=timestamp "__tomorrow__ 00:00:00.000" order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 301 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 302 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 303 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 304 | 1 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 401 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 402 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 403 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select timestamp "__tomorrow__ 00:00:00.000" 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>timestamp "__tomorrow__ 00:00:00.000" where tb.ts>timestamp "__tomorrow__ 00:00:00.000";
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
ts1 |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:00.000 | 301 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 302 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 303 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 304 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 401 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 402 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 403 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 404 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__tomorrow__ 00:00:00.000" where tb.ts=timestamp "__tomorrow__ 00:00:00.000" order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:00.000 | 301 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 302 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 303 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 304 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 401 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 402 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 403 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 404 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__tomorrow__ 00:00:00.000" where tb.ts>timestamp "__tomorrow__ 00:00:00.000";
taos> select * from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts | f | g | 'a' |
==================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select * from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select b.ts1 from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
ts1 |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select * from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
ts1 |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select * from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select a.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select b.c from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select * from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 | __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select a.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select b.c from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where 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 timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where 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 timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 301 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 302 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 303 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 304 | 1 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 401 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 402 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 403 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__tomorrow__ 00:00:00.000" order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 301 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 302 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 303 | 1 |
__tomorrow__ 00:00:00.000 | 103 | 1 | __tomorrow__ 00:00:00.000 | 304 | 1 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 401 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 402 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 403 | 2 |
__tomorrow__ 00:00:00.000 | 203 | 2 | __tomorrow__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__tomorrow__ 00:00:00.000" ;
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__tomorrow__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select b.ts1 from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
ts1 |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
ts1 |
==========================
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:00.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__tomorrow__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select a.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__tomorrow__ 00:00:00.000 | 103 | 1013 |
taos> select b.* from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
taos> select b.c from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select timestamp "__tomorrow__ 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__tomorrow__ 00:00:00.000 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:00.000 | 301 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 302 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 303 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 304 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 401 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 402 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 403 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 404 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__tomorrow__ 00:00:00.000" order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:00.000 | 301 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 302 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 303 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 304 | 1 | __tomorrow__ 00:00:00.000 | 103 | 1 |
__tomorrow__ 00:00:00.000 | 401 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 402 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 403 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
__tomorrow__ 00:00:00.000 | 404 | 2 | __tomorrow__ 00:00:00.000 | 203 | 2 |
taos> select * from (select timestamp "__tomorrow__ 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__tomorrow__ 00:00:00.000" ;
Can't render this file because it contains an unexpected character in line 5 and column 49.

View File

@ -0,0 +1,969 @@
taos> use test;
Database changed.
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | ts | f | g | 'a' |
==================================================================================================================
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 304 | 3014 | a |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 304 | 3014 | a |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 304 | 3014 | a |
taos> select a.*, b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts |
================================================================================
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 |
__today__ 00:00:01.000 | 102 | 1012 | __tomorrow__ 00:00:00.000 |
__today__ 00:00:01.000 | 102 | 1012 | __tomorrow__ 00:00:02.000 |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | 102 | 1012 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:01.000 |
taos> select * from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select a.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | 102 | 1012 |
taos> select b.* from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s 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:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select b.c from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1) a join (select timestamp "__today__ 00:00:00.000" + 1s 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 timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s 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 timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a join (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 301 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 302 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 303 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 304 | 1 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 401 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 402 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 403 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select timestamp "__today__ 00:00:00.000" + 1s 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=timestamp "__today__ 00:00:00.000" + 1s where tb.ts=timestamp "__today__ 00:00:00.000" + 1s order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 301 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 302 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 303 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 304 | 1 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 401 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 402 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 403 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select timestamp "__today__ 00:00:00.000" + 1s 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>timestamp "__today__ 00:00:00.000" + 1s where tb.ts>timestamp "__today__ 00:00:00.000" + 1s;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:01.000 | 301 | 3011 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 303 | 3013 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 304 | 3014 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:01.000 | 301 | 3011 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 303 | 3013 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 304 | 3014 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 304 | 3014 | a |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
ts1 |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:01.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:01.000 | 301 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 302 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 303 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 304 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 401 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 402 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 403 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 404 | 2 | __today__ 00:00:01.000 | 202 | 2 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__today__ 00:00:00.000" + 1s where tb.ts=timestamp "__today__ 00:00:00.000" + 1s order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:01.000 | 301 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 302 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 303 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 304 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 401 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 402 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 403 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 404 | 2 | __today__ 00:00:01.000 | 202 | 2 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__today__ 00:00:00.000" + 1s where tb.ts>timestamp "__today__ 00:00:00.000" + 1s;
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts | f | g | 'a' |
==================================================================================================================
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 304 | 3014 | a |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select b.ts1 from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
ts1 |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
ts1 |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:01.000 |
taos> select * from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select a.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select b.c from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where 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 timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where 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 timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from a1 order by f) a , (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 301 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 302 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 303 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 304 | 1 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 401 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 402 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 403 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__today__ 00:00:00.000" + 1s order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 301 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 302 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 303 | 1 |
__today__ 00:00:01.000 | 102 | 1 | __today__ 00:00:01.000 | 304 | 1 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 401 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 402 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 403 | 2 |
__today__ 00:00:01.000 | 202 | 2 | __today__ 00:00:01.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__today__ 00:00:00.000" + 1s ;
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:01.000 | 301 | 3011 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 303 | 3013 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 304 | 3014 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:01.000 | 301 | 3011 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 303 | 3013 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 304 | 3014 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:01.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select b.ts1 from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
ts1 |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
ts1 |
==========================
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
__today__ 00:00:01.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:01.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:01.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
taos> select a.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:01.000 | 102 | 1012 |
taos> select b.* from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
taos> select b.c from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select timestamp "__today__ 00:00:00.000" + 1s as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:01.000 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:01.000 | 301 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 302 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 303 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 304 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 401 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 402 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 403 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 404 | 2 | __today__ 00:00:01.000 | 202 | 2 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=timestamp "__today__ 00:00:00.000" + 1s order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:01.000 | 301 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 302 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 303 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 304 | 1 | __today__ 00:00:01.000 | 102 | 1 |
__today__ 00:00:01.000 | 401 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 402 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 403 | 2 | __today__ 00:00:01.000 | 202 | 2 |
__today__ 00:00:01.000 | 404 | 2 | __today__ 00:00:01.000 | 202 | 2 |
taos> select * from (select timestamp "__today__ 00:00:00.000" + 1s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>timestamp "__today__ 00:00:00.000" + 1s ;
Can't render this file because it contains an unexpected character in line 5 and column 49.

View File

@ -0,0 +1,490 @@
taos> use test;
Database changed.
taos> select * from a1 a left join (select now 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 | 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 | NULL | NULL | NULL | NU. |
taos> select * from a1 a left join (select now 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 | 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 | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select now 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: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 now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select b.* from a1 a left join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select a.*, b.ts from a1 a left join (select now 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 | NULL |
__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 now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
NU. |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select * from a1 a left join (select now 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 | 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 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select now 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: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 now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
NULL | NULL | NULL | NULL | NU. |
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 now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
NU. |
NU. |
NU. |
NU. |
taos> select a.* from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.ts1,a.ts from a1 a left join (select now as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
NULL | __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 a.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.c from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a left join (select now 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 | 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 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
NULL | NULL | NULL | NULL | NU. |
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 now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
c |
======
NU. |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select * from a1 a left join (select now 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 | 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 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
NULL | NULL | NULL | NULL | NU. |
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 now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
c |
======
NU. |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select b.ts from (select now 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.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 now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now 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 now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left join (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__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 | NULL | NULL | NULL |
__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 | 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 now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select a.* from (select now as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.c from (select now as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.g from (select now as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
g |
==============
3011 |
3012 |
3013 |
3014 |
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.c from (select now as ts1, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts,a.* from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
ts | ts | f | g |
================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.*,b.ts from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts |
================================================================================
NULL | NULL | NULL | __today__ 00:00:00.000 |
NULL | NULL | NULL | __today__ 00:00:01.000 |
NULL | NULL | NULL | __tomorrow__ 00:00:00.000 |
NULL | NULL | NULL | __tomorrow__ 00:00:02.000 |
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.ts,b.f from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f |
========================================
__today__ 00:00:00.000 | 301 |
__today__ 00:00:01.000 | 302 |
__tomorrow__ 00:00:00.000 | 303 |
__tomorrow__ 00:00:02.000 | 304 |
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts, a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | ts | f | g |
================================================================================
__today__ 00:00:00.000 | NULL | NULL | NULL |
__today__ 00:00:01.000 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | NULL | NULL | NULL |
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.g from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
g |
==============
3011 |
3012 |
3013 |
3014 |
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select tb.val,tb.tg1,ta.* from (select now 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;
val | tg1 | ts | val | tg1 |
==================================================================================
404 | 1 | NULL | NULL | NULL |
taos> select tb.val,tb.tg2,ta.* from (select now 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;
val | tg2 | ts | val | tg2 |
==================================================================================
304 | 1 | NULL | NULL | NULL |
404 | 2 | NULL | NULL | NULL |
taos> select tb.val,tb.tg2,ta.* from (select now 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;
val | tg2 | ts | val | tg2 |
==================================================================================
301 | 1 | NULL | NULL | NULL |
302 | 1 | NULL | NULL | NULL |
303 | 1 | NULL | NULL | NULL |
304 | 1 | NULL | NULL | NULL |
401 | 2 | NULL | NULL | NULL |
402 | 2 | NULL | NULL | NULL |
403 | 2 | NULL | NULL | NULL |
404 | 2 | NULL | NULL | NULL |
taos> select tb.val,tb.tg2,ta.* from (select now 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=now where tb.ts=now order by tb.val;
val | tg2 | ts | val | tg2 |
==================================================================================
301 | 1 | NULL | NULL | NULL |
302 | 1 | NULL | NULL | NULL |
303 | 1 | NULL | NULL | NULL |
304 | 1 | NULL | NULL | NULL |
401 | 2 | NULL | NULL | NULL |
402 | 2 | NULL | NULL | NULL |
403 | 2 | NULL | NULL | NULL |
404 | 2 | NULL | NULL | NULL |
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb 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>now where tb.ts>now;
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a left join (select now 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 | NULL | NULL | NULL | NU. |
7 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
8 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
9 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
10 taos> select * from a1 a left join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
11 ts | f | g | ts1 | f | g | 'a' |
12 ==================================================================================================================
13 __today__ 00:00:00.000 | 101 | 1011 | NULL | NULL | NULL | NU. |
14 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
15 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
16 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
17 taos> select a.* from a1 a left join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
18 ts | f | g |
19 ======================================================
20 __today__ 00:00:00.000 | 101 | 1011 |
21 __today__ 00:00:01.000 | 102 | 1012 |
22 __tomorrow__ 00:00:00.000 | 103 | 1013 |
23 __tomorrow__ 00:00:02.000 | 104 | 1014 |
24 taos> select b.* from a1 a left join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
25 ts | f | g | 'a' |
26 ============================================================
27 NULL | NULL | NULL | NU. |
28 NULL | NULL | NULL | NU. |
29 NULL | NULL | NULL | NU. |
30 NULL | NULL | NULL | NU. |
31 taos> select b.* from a1 a left join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
32 ts1 | f | g | 'a' |
33 ============================================================
34 NULL | NULL | NULL | NU. |
35 NULL | NULL | NULL | NU. |
36 NULL | NULL | NULL | NU. |
37 NULL | NULL | NULL | NU. |
38 taos> select a.*, b.ts from a1 a left join (select now as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
39 ts | f | g | ts |
40 ================================================================================
41 __today__ 00:00:00.000 | 101 | 1011 | NULL |
42 __today__ 00:00:01.000 | 102 | 1012 | NULL |
43 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL |
44 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL |
45 taos> select b.c from a1 a left join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
46 c |
47 ======
48 NU. |
49 NU. |
50 NU. |
51 NU. |
52 taos> select b.ts from a1 a left join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
53 ts |
54 ==========================
55 NULL |
56 NULL |
57 NULL |
58 NULL |
59 taos> select * from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
60 ts | f | g | ts1 | ts | f | g | 'a' |
61 ============================================================================================================================================
62 __today__ 00:00:00.000 | 101 | 1011 | NULL | NULL | NULL | NULL | NU. |
63 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
64 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
65 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
66 taos> select a.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
67 ts | f | g |
68 ======================================================
69 __today__ 00:00:00.000 | 101 | 1011 |
70 __today__ 00:00:01.000 | 102 | 1012 |
71 __tomorrow__ 00:00:00.000 | 103 | 1013 |
72 __tomorrow__ 00:00:02.000 | 104 | 1014 |
73 taos> select b.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
74 ts1 | ts | f | g | 'a' |
75 ======================================================================================
76 NULL | NULL | NULL | NULL | NU. |
77 NULL | NULL | NULL | NULL | NU. |
78 NULL | NULL | NULL | NULL | NU. |
79 NULL | NULL | NULL | NULL | NU. |
80 taos> select b.c from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
81 c |
82 ======
83 NU. |
84 NU. |
85 NU. |
86 NU. |
87 taos> select a.* from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
88 ts | f | g |
89 ======================================================
90 __today__ 00:00:00.000 | 101 | 1011 |
91 __today__ 00:00:01.000 | 102 | 1012 |
92 __tomorrow__ 00:00:00.000 | 103 | 1013 |
93 __tomorrow__ 00:00:02.000 | 104 | 1014 |
94 taos> select b.ts1,a.ts from a1 a left join (select now as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
95 ts1 | ts |
96 ====================================================
97 NULL | __today__ 00:00:00.000 |
98 NULL | __today__ 00:00:01.000 |
99 NULL | __tomorrow__ 00:00:00.000 |
100 NULL | __tomorrow__ 00:00:02.000 |
101 taos> select a.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
102 ts | f | g |
103 ======================================================
104 __today__ 00:00:00.000 | 101 | 1011 |
105 __today__ 00:00:01.000 | 102 | 1012 |
106 __tomorrow__ 00:00:00.000 | 103 | 1013 |
107 __tomorrow__ 00:00:02.000 | 104 | 1014 |
108 taos> select b.c from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
109 c |
110 ======
111 a |
112 a |
113 a |
114 a |
115 taos> select b.ts from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
116 ts |
117 ==========================
118 __today__ 00:00:00.000 |
119 __today__ 00:00:01.000 |
120 __tomorrow__ 00:00:00.000 |
121 __tomorrow__ 00:00:02.000 |
122 taos> select * from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
123 ts | f | g | ts1 | ts | f | g | 'a' |
124 ============================================================================================================================================
125 __today__ 00:00:00.000 | 101 | 1011 | NULL | NULL | NULL | NULL | NU. |
126 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
127 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
128 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
129 taos> select a.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
130 ts | f | g |
131 ======================================================
132 __today__ 00:00:00.000 | 101 | 1011 |
133 __today__ 00:00:01.000 | 102 | 1012 |
134 __tomorrow__ 00:00:00.000 | 103 | 1013 |
135 __tomorrow__ 00:00:02.000 | 104 | 1014 |
136 taos> select b.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
137 ts1 | ts | f | g | 'a' |
138 ======================================================================================
139 NULL | NULL | NULL | NULL | NU. |
140 NULL | NULL | NULL | NULL | NU. |
141 NULL | NULL | NULL | NULL | NU. |
142 NULL | NULL | NULL | NULL | NU. |
143 taos> select b.c from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
144 c |
145 ======
146 NU. |
147 NU. |
148 NU. |
149 NU. |
150 taos> select b.ts from a1 a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
151 ts |
152 ==========================
153 NULL |
154 NULL |
155 NULL |
156 NULL |
157 taos> select * from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
158 ts | f | g | ts1 | ts | f | g | 'a' |
159 ============================================================================================================================================
160 __today__ 00:00:00.000 | 101 | 1011 | NULL | NULL | NULL | NULL | NU. |
161 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
162 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
163 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
164 taos> select a.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
165 ts | f | g |
166 ======================================================
167 __today__ 00:00:00.000 | 101 | 1011 |
168 __today__ 00:00:01.000 | 102 | 1012 |
169 __tomorrow__ 00:00:00.000 | 103 | 1013 |
170 __tomorrow__ 00:00:02.000 | 104 | 1014 |
171 taos> select b.* from a1 a left join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
172 ts1 | ts | f | g | 'a' |
173 ======================================================================================
174 NULL | NULL | NULL | NULL | NU. |
175 NULL | NULL | NULL | NULL | NU. |
176 NULL | NULL | NULL | NULL | NU. |
177 NULL | NULL | NULL | NULL | NU. |
178 taos> select b.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;
179 c |
180 ======
181 NU. |
182 NU. |
183 NU. |
184 NU. |
185 taos> select b.ts 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;
186 ts |
187 ==========================
188 NULL |
189 NULL |
190 NULL |
191 NULL |
192 taos> select b.ts from (select now 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;
193 ts |
194 ==========================
195 NULL |
196 NULL |
197 NULL |
198 NULL |
199 taos> select b.ts from (select now 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.ts1 = a.ts1 and a.ts = b.ts;
200 ts |
201 ==========================
202 __today__ 00:00:00.000 |
203 __today__ 00:00:01.000 |
204 __tomorrow__ 00:00:00.000 |
205 __tomorrow__ 00:00:02.000 |
206 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) 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;
207 ts |
208 ==========================
209 NULL |
210 NULL |
211 NULL |
212 NULL |
213 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
214 ts |
215 ==========================
216 __today__ 00:00:00.000 |
217 __today__ 00:00:01.000 |
218 __tomorrow__ 00:00:00.000 |
219 __tomorrow__ 00:00:02.000 |
220 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) 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;
221 ts |
222 ==========================
223 NULL |
224 NULL |
225 NULL |
226 NULL |
227 taos> select b.ts from (select now 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;
228 ts |
229 ==========================
230 NULL |
231 NULL |
232 NULL |
233 NULL |
234 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 now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
235 ts | val | tg1 | ts | val | tg1 |
236 ============================================================================================================
237 __tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
238 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 now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
239 ts | val | tg2 | ts | val | tg2 |
240 ============================================================================================================
241 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
242 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
243 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 now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.val;
244 ts | val | tg2 | ts | val | tg2 |
245 ============================================================================================================
246 __today__ 00:00:00.000 | 101 | 1 | NULL | NULL | NULL |
247 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
248 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
249 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
250 __today__ 00:00:00.000 | 201 | 2 | NULL | NULL | NULL |
251 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
252 __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
253 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
254 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 now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
255 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 now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
256 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;
257 ts | val | tg2 | ts | val | tg2 |
258 ============================================================================================================
259 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
260 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
261 taos> select a.* from (select now as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
262 ts | f | g |
263 ======================================================
264 NULL | NULL | NULL |
265 NULL | NULL | NULL |
266 NULL | NULL | NULL |
267 NULL | NULL | NULL |
268 taos> select b.c from (select now as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
269 c |
270 ======
271 a |
272 a |
273 a |
274 a |
275 taos> select b.g from (select now as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
276 g |
277 ==============
278 3011 |
279 3012 |
280 3013 |
281 3014 |
282 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
283 ts | f | g |
284 ======================================================
285 NULL | NULL | NULL |
286 NULL | NULL | NULL |
287 NULL | NULL | NULL |
288 NULL | NULL | NULL |
289 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
290 c |
291 ======
292 a |
293 a |
294 a |
295 a |
296 taos> select b.c from (select now as ts1, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
297 c |
298 ======
299 a |
300 a |
301 a |
302 a |
303 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
304 ts | f | g |
305 ======================================================
306 __today__ 00:00:00.000 | 101 | 1011 |
307 __today__ 00:00:01.000 | 102 | 1012 |
308 __tomorrow__ 00:00:00.000 | 103 | 1013 |
309 __tomorrow__ 00:00:02.000 | 104 | 1014 |
310 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
311 c |
312 ======
313 a |
314 a |
315 a |
316 a |
317 taos> select b.ts,a.* from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
318 ts | ts | f | g |
319 ================================================================================
320 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 |
321 __today__ 00:00:01.000 | __today__ 00:00:01.000 | 102 | 1012 |
322 __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 |
323 __tomorrow__ 00:00:02.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 |
324 taos> select a.*,b.ts from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
325 ts | f | g | ts |
326 ================================================================================
327 NULL | NULL | NULL | __today__ 00:00:00.000 |
328 NULL | NULL | NULL | __today__ 00:00:01.000 |
329 NULL | NULL | NULL | __tomorrow__ 00:00:00.000 |
330 NULL | NULL | NULL | __tomorrow__ 00:00:02.000 |
331 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
332 ts | f | g |
333 ======================================================
334 NULL | NULL | NULL |
335 NULL | NULL | NULL |
336 NULL | NULL | NULL |
337 NULL | NULL | NULL |
338 taos> select b.ts,b.f from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
339 ts | f |
340 ========================================
341 __today__ 00:00:00.000 | 301 |
342 __today__ 00:00:01.000 | 302 |
343 __tomorrow__ 00:00:00.000 | 303 |
344 __tomorrow__ 00:00:02.000 | 304 |
345 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
346 c |
347 ======
348 a |
349 a |
350 a |
351 a |
352 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
353 ts |
354 ==========================
355 __today__ 00:00:00.000 |
356 __today__ 00:00:01.000 |
357 __tomorrow__ 00:00:00.000 |
358 __tomorrow__ 00:00:02.000 |
359 taos> select b.ts, a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
360 ts | ts | f | g |
361 ================================================================================
362 __today__ 00:00:00.000 | NULL | NULL | NULL |
363 __today__ 00:00:01.000 | NULL | NULL | NULL |
364 __tomorrow__ 00:00:00.000 | NULL | NULL | NULL |
365 __tomorrow__ 00:00:02.000 | NULL | NULL | NULL |
366 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
367 ts | f | g |
368 ======================================================
369 NULL | NULL | NULL |
370 NULL | NULL | NULL |
371 NULL | NULL | NULL |
372 NULL | NULL | NULL |
373 taos> select b.g from (select now as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
374 g |
375 ==============
376 3011 |
377 3012 |
378 3013 |
379 3014 |
380 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
381 c |
382 ======
383 a |
384 a |
385 a |
386 a |
387 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
388 ts |
389 ==========================
390 __today__ 00:00:00.000 |
391 __today__ 00:00:01.000 |
392 __tomorrow__ 00:00:00.000 |
393 __tomorrow__ 00:00:02.000 |
394 taos> select tb.val,tb.tg1,ta.* from (select now 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;
395 val | tg1 | ts | val | tg1 |
396 ==================================================================================
397 404 | 1 | NULL | NULL | NULL |
398 taos> select tb.val,tb.tg2,ta.* from (select now 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;
399 val | tg2 | ts | val | tg2 |
400 ==================================================================================
401 304 | 1 | NULL | NULL | NULL |
402 404 | 2 | NULL | NULL | NULL |
403 taos> select tb.val,tb.tg2,ta.* from (select now 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;
404 val | tg2 | ts | val | tg2 |
405 ==================================================================================
406 301 | 1 | NULL | NULL | NULL |
407 302 | 1 | NULL | NULL | NULL |
408 303 | 1 | NULL | NULL | NULL |
409 304 | 1 | NULL | NULL | NULL |
410 401 | 2 | NULL | NULL | NULL |
411 402 | 2 | NULL | NULL | NULL |
412 403 | 2 | NULL | NULL | NULL |
413 404 | 2 | NULL | NULL | NULL |
414 taos> select tb.val,tb.tg2,ta.* from (select now 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=now where tb.ts=now order by tb.val;
415 val | tg2 | ts | val | tg2 |
416 ==================================================================================
417 301 | 1 | NULL | NULL | NULL |
418 302 | 1 | NULL | NULL | NULL |
419 303 | 1 | NULL | NULL | NULL |
420 304 | 1 | NULL | NULL | NULL |
421 401 | 2 | NULL | NULL | NULL |
422 402 | 2 | NULL | NULL | NULL |
423 403 | 2 | NULL | NULL | NULL |
424 404 | 2 | NULL | NULL | NULL |
425 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb 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>now where tb.ts>now;

View File

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

View File

@ -0,0 +1,490 @@
taos> use test;
Database changed.
taos> select * from a1 a left join (select now() 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 | 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 | NULL | NULL | NULL | NU. |
taos> select * from a1 a left join (select now() 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 | 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 | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select now() 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: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 now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select b.* from a1 a left join (select now() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
NULL | NULL | NULL | NU. |
taos> select a.*, b.ts from a1 a left join (select now() 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 | NULL |
__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 now() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
NU. |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select now() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select * from a1 a left join (select now() 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 | 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 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select now() 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: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 now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
NULL | NULL | NULL | NULL | NU. |
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 now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
NU. |
NU. |
NU. |
NU. |
taos> select a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.ts1,a.ts from a1 a left join (select now() as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
NULL | __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 a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.c from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a left join (select now() 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 | 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 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
NULL | NULL | NULL | NULL | NU. |
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 now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
c |
======
NU. |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select * from a1 a left join (select now() 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 | 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 | NULL | NULL | NULL | NULL | NU. |
taos> select a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
NULL | NULL | NULL | NULL | NU. |
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 now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
c |
======
NU. |
NU. |
NU. |
NU. |
taos> select b.ts from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select b.ts from (select now() 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.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 now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() 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 now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
NULL |
NULL |
NULL |
NULL |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta left join (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
ts | val | tg1 | ts | val | tg1 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__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 | NULL | NULL | NULL |
__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 | 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 now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta left join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now();
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta left join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select a.* from (select now() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.c from (select now() as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.g from (select now() as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
g |
==============
3011 |
3012 |
3013 |
3014 |
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.c from (select now() as ts1, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts,a.* from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
ts | ts | f | g |
================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | __today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.*,b.ts from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts |
================================================================================
NULL | NULL | NULL | __today__ 00:00:00.000 |
NULL | NULL | NULL | __today__ 00:00:01.000 |
NULL | NULL | NULL | __tomorrow__ 00:00:00.000 |
NULL | NULL | NULL | __tomorrow__ 00:00:02.000 |
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.ts,b.f from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f |
========================================
__today__ 00:00:00.000 | 301 |
__today__ 00:00:01.000 | 302 |
__tomorrow__ 00:00:00.000 | 303 |
__tomorrow__ 00:00:02.000 | 304 |
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts, a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | ts | f | g |
================================================================================
__today__ 00:00:00.000 | NULL | NULL | NULL |
__today__ 00:00:01.000 | NULL | NULL | NULL |
__tomorrow__ 00:00:00.000 | NULL | NULL | NULL |
__tomorrow__ 00:00:02.000 | NULL | NULL | NULL |
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
NULL | NULL | NULL |
taos> select b.g from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
g |
==============
3011 |
3012 |
3013 |
3014 |
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select tb.val,tb.tg1,ta.* from (select now() 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;
val | tg1 | ts | val | tg1 |
==================================================================================
404 | 1 | NULL | NULL | NULL |
taos> select tb.val,tb.tg2,ta.* from (select now() 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;
val | tg2 | ts | val | tg2 |
==================================================================================
304 | 1 | NULL | NULL | NULL |
404 | 2 | NULL | NULL | NULL |
taos> select tb.val,tb.tg2,ta.* from (select now() 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;
val | tg2 | ts | val | tg2 |
==================================================================================
301 | 1 | NULL | NULL | NULL |
302 | 1 | NULL | NULL | NULL |
303 | 1 | NULL | NULL | NULL |
304 | 1 | NULL | NULL | NULL |
401 | 2 | NULL | NULL | NULL |
402 | 2 | NULL | NULL | NULL |
403 | 2 | NULL | NULL | NULL |
404 | 2 | NULL | NULL | NULL |
taos> select tb.val,tb.tg2,ta.* from (select now() 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=now() where tb.ts=now() order by tb.val;
val | tg2 | ts | val | tg2 |
==================================================================================
301 | 1 | NULL | NULL | NULL |
302 | 1 | NULL | NULL | NULL |
303 | 1 | NULL | NULL | NULL |
304 | 1 | NULL | NULL | NULL |
401 | 2 | NULL | NULL | NULL |
402 | 2 | NULL | NULL | NULL |
403 | 2 | NULL | NULL | NULL |
404 | 2 | NULL | NULL | NULL |
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb 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>now() where tb.ts>now();
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a left join (select now() 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 | NULL | NULL | NULL | NU. |
7 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
8 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
9 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
10 taos> select * from a1 a left join (select now() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
11 ts | f | g | ts1 | f | g | 'a' |
12 ==================================================================================================================
13 __today__ 00:00:00.000 | 101 | 1011 | NULL | NULL | NULL | NU. |
14 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
15 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
16 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
17 taos> select a.* from a1 a left join (select now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
18 ts | f | g |
19 ======================================================
20 __today__ 00:00:00.000 | 101 | 1011 |
21 __today__ 00:00:01.000 | 102 | 1012 |
22 __tomorrow__ 00:00:00.000 | 103 | 1013 |
23 __tomorrow__ 00:00:02.000 | 104 | 1014 |
24 taos> select b.* from a1 a left join (select now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
25 ts | f | g | 'a' |
26 ============================================================
27 NULL | NULL | NULL | NU. |
28 NULL | NULL | NULL | NU. |
29 NULL | NULL | NULL | NU. |
30 NULL | NULL | NULL | NU. |
31 taos> select b.* from a1 a left join (select now() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
32 ts1 | f | g | 'a' |
33 ============================================================
34 NULL | NULL | NULL | NU. |
35 NULL | NULL | NULL | NU. |
36 NULL | NULL | NULL | NU. |
37 NULL | NULL | NULL | NU. |
38 taos> select a.*, b.ts from a1 a left join (select now() as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
39 ts | f | g | ts |
40 ================================================================================
41 __today__ 00:00:00.000 | 101 | 1011 | NULL |
42 __today__ 00:00:01.000 | 102 | 1012 | NULL |
43 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL |
44 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL |
45 taos> select b.c from a1 a left join (select now() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
46 c |
47 ======
48 NU. |
49 NU. |
50 NU. |
51 NU. |
52 taos> select b.ts from a1 a left join (select now() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
53 ts |
54 ==========================
55 NULL |
56 NULL |
57 NULL |
58 NULL |
59 taos> select * from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
60 ts | f | g | ts1 | ts | f | g | 'a' |
61 ============================================================================================================================================
62 __today__ 00:00:00.000 | 101 | 1011 | NULL | NULL | NULL | NULL | NU. |
63 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
64 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
65 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
66 taos> select a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
67 ts | f | g |
68 ======================================================
69 __today__ 00:00:00.000 | 101 | 1011 |
70 __today__ 00:00:01.000 | 102 | 1012 |
71 __tomorrow__ 00:00:00.000 | 103 | 1013 |
72 __tomorrow__ 00:00:02.000 | 104 | 1014 |
73 taos> select b.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
74 ts1 | ts | f | g | 'a' |
75 ======================================================================================
76 NULL | NULL | NULL | NULL | NU. |
77 NULL | NULL | NULL | NULL | NU. |
78 NULL | NULL | NULL | NULL | NU. |
79 NULL | NULL | NULL | NULL | NU. |
80 taos> select b.c from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
81 c |
82 ======
83 NU. |
84 NU. |
85 NU. |
86 NU. |
87 taos> select a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
88 ts | f | g |
89 ======================================================
90 __today__ 00:00:00.000 | 101 | 1011 |
91 __today__ 00:00:01.000 | 102 | 1012 |
92 __tomorrow__ 00:00:00.000 | 103 | 1013 |
93 __tomorrow__ 00:00:02.000 | 104 | 1014 |
94 taos> select b.ts1,a.ts from a1 a left join (select now() as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
95 ts1 | ts |
96 ====================================================
97 NULL | __today__ 00:00:00.000 |
98 NULL | __today__ 00:00:01.000 |
99 NULL | __tomorrow__ 00:00:00.000 |
100 NULL | __tomorrow__ 00:00:02.000 |
101 taos> select a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
102 ts | f | g |
103 ======================================================
104 __today__ 00:00:00.000 | 101 | 1011 |
105 __today__ 00:00:01.000 | 102 | 1012 |
106 __tomorrow__ 00:00:00.000 | 103 | 1013 |
107 __tomorrow__ 00:00:02.000 | 104 | 1014 |
108 taos> select b.c from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
109 c |
110 ======
111 a |
112 a |
113 a |
114 a |
115 taos> select b.ts from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
116 ts |
117 ==========================
118 __today__ 00:00:00.000 |
119 __today__ 00:00:01.000 |
120 __tomorrow__ 00:00:00.000 |
121 __tomorrow__ 00:00:02.000 |
122 taos> select * from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
123 ts | f | g | ts1 | ts | f | g | 'a' |
124 ============================================================================================================================================
125 __today__ 00:00:00.000 | 101 | 1011 | NULL | NULL | NULL | NULL | NU. |
126 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
127 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
128 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
129 taos> select a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
130 ts | f | g |
131 ======================================================
132 __today__ 00:00:00.000 | 101 | 1011 |
133 __today__ 00:00:01.000 | 102 | 1012 |
134 __tomorrow__ 00:00:00.000 | 103 | 1013 |
135 __tomorrow__ 00:00:02.000 | 104 | 1014 |
136 taos> select b.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
137 ts1 | ts | f | g | 'a' |
138 ======================================================================================
139 NULL | NULL | NULL | NULL | NU. |
140 NULL | NULL | NULL | NULL | NU. |
141 NULL | NULL | NULL | NULL | NU. |
142 NULL | NULL | NULL | NULL | NU. |
143 taos> select b.c from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
144 c |
145 ======
146 NU. |
147 NU. |
148 NU. |
149 NU. |
150 taos> select b.ts from a1 a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
151 ts |
152 ==========================
153 NULL |
154 NULL |
155 NULL |
156 NULL |
157 taos> select * from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
158 ts | f | g | ts1 | ts | f | g | 'a' |
159 ============================================================================================================================================
160 __today__ 00:00:00.000 | 101 | 1011 | NULL | NULL | NULL | NULL | NU. |
161 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
162 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
163 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
164 taos> select a.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
165 ts | f | g |
166 ======================================================
167 __today__ 00:00:00.000 | 101 | 1011 |
168 __today__ 00:00:01.000 | 102 | 1012 |
169 __tomorrow__ 00:00:00.000 | 103 | 1013 |
170 __tomorrow__ 00:00:02.000 | 104 | 1014 |
171 taos> select b.* from a1 a left join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
172 ts1 | ts | f | g | 'a' |
173 ======================================================================================
174 NULL | NULL | NULL | NULL | NU. |
175 NULL | NULL | NULL | NULL | NU. |
176 NULL | NULL | NULL | NULL | NU. |
177 NULL | NULL | NULL | NULL | NU. |
178 taos> select b.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;
179 c |
180 ======
181 NU. |
182 NU. |
183 NU. |
184 NU. |
185 taos> select b.ts 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;
186 ts |
187 ==========================
188 NULL |
189 NULL |
190 NULL |
191 NULL |
192 taos> select b.ts from (select now() 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;
193 ts |
194 ==========================
195 NULL |
196 NULL |
197 NULL |
198 NULL |
199 taos> select b.ts from (select now() 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.ts1 = a.ts1 and a.ts = b.ts;
200 ts |
201 ==========================
202 __today__ 00:00:00.000 |
203 __today__ 00:00:01.000 |
204 __tomorrow__ 00:00:00.000 |
205 __tomorrow__ 00:00:02.000 |
206 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) 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;
207 ts |
208 ==========================
209 NULL |
210 NULL |
211 NULL |
212 NULL |
213 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a left join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
214 ts |
215 ==========================
216 __today__ 00:00:00.000 |
217 __today__ 00:00:01.000 |
218 __tomorrow__ 00:00:00.000 |
219 __tomorrow__ 00:00:02.000 |
220 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) 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;
221 ts |
222 ==========================
223 NULL |
224 NULL |
225 NULL |
226 NULL |
227 taos> select b.ts from (select now() 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;
228 ts |
229 ==========================
230 NULL |
231 NULL |
232 NULL |
233 NULL |
234 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 now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
235 ts | val | tg1 | ts | val | tg1 |
236 ============================================================================================================
237 __tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
238 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 now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
239 ts | val | tg2 | ts | val | tg2 |
240 ============================================================================================================
241 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
242 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
243 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 now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.val;
244 ts | val | tg2 | ts | val | tg2 |
245 ============================================================================================================
246 __today__ 00:00:00.000 | 101 | 1 | NULL | NULL | NULL |
247 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
248 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
249 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
250 __today__ 00:00:00.000 | 201 | 2 | NULL | NULL | NULL |
251 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
252 __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
253 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
254 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 now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;
255 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 now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now();
256 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;
257 ts | val | tg2 | ts | val | tg2 |
258 ============================================================================================================
259 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
260 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
261 taos> select a.* from (select now() as ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
262 ts | f | g |
263 ======================================================
264 NULL | NULL | NULL |
265 NULL | NULL | NULL |
266 NULL | NULL | NULL |
267 NULL | NULL | NULL |
268 taos> select b.c from (select now() as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
269 c |
270 ======
271 a |
272 a |
273 a |
274 a |
275 taos> select b.g from (select now() as ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
276 g |
277 ==============
278 3011 |
279 3012 |
280 3013 |
281 3014 |
282 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts;
283 ts | f | g |
284 ======================================================
285 NULL | NULL | NULL |
286 NULL | NULL | NULL |
287 NULL | NULL | NULL |
288 NULL | NULL | NULL |
289 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
290 c |
291 ======
292 a |
293 a |
294 a |
295 a |
296 taos> select b.c from (select now() as ts1, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts;
297 c |
298 ======
299 a |
300 a |
301 a |
302 a |
303 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on a.ts = b.ts;
304 ts | f | g |
305 ======================================================
306 __today__ 00:00:00.000 | 101 | 1011 |
307 __today__ 00:00:01.000 | 102 | 1012 |
308 __tomorrow__ 00:00:00.000 | 103 | 1013 |
309 __tomorrow__ 00:00:02.000 | 104 | 1014 |
310 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
311 c |
312 ======
313 a |
314 a |
315 a |
316 a |
317 taos> select b.ts,a.* from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on a.ts = b.ts;
318 ts | ts | f | g |
319 ================================================================================
320 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 101 | 1011 |
321 __today__ 00:00:01.000 | __today__ 00:00:01.000 | 102 | 1012 |
322 __tomorrow__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 103 | 1013 |
323 __tomorrow__ 00:00:02.000 | __tomorrow__ 00:00:02.000 | 104 | 1014 |
324 taos> select a.*,b.ts from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
325 ts | f | g | ts |
326 ================================================================================
327 NULL | NULL | NULL | __today__ 00:00:00.000 |
328 NULL | NULL | NULL | __today__ 00:00:01.000 |
329 NULL | NULL | NULL | __tomorrow__ 00:00:00.000 |
330 NULL | NULL | NULL | __tomorrow__ 00:00:02.000 |
331 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
332 ts | f | g |
333 ======================================================
334 NULL | NULL | NULL |
335 NULL | NULL | NULL |
336 NULL | NULL | NULL |
337 NULL | NULL | NULL |
338 taos> select b.ts,b.f from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
339 ts | f |
340 ========================================
341 __today__ 00:00:00.000 | 301 |
342 __today__ 00:00:01.000 | 302 |
343 __tomorrow__ 00:00:00.000 | 303 |
344 __tomorrow__ 00:00:02.000 | 304 |
345 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
346 c |
347 ======
348 a |
349 a |
350 a |
351 a |
352 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts1 = a.ts and a.ts = b.ts;
353 ts |
354 ==========================
355 __today__ 00:00:00.000 |
356 __today__ 00:00:01.000 |
357 __tomorrow__ 00:00:00.000 |
358 __tomorrow__ 00:00:02.000 |
359 taos> select b.ts, a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
360 ts | ts | f | g |
361 ================================================================================
362 __today__ 00:00:00.000 | NULL | NULL | NULL |
363 __today__ 00:00:01.000 | NULL | NULL | NULL |
364 __tomorrow__ 00:00:00.000 | NULL | NULL | NULL |
365 __tomorrow__ 00:00:02.000 | NULL | NULL | NULL |
366 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
367 ts | f | g |
368 ======================================================
369 NULL | NULL | NULL |
370 NULL | NULL | NULL |
371 NULL | NULL | NULL |
372 NULL | NULL | NULL |
373 taos> select b.g from (select now() as ts1, ts, f, g, 'a' from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
374 g |
375 ==============
376 3011 |
377 3012 |
378 3013 |
379 3014 |
380 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
381 c |
382 ======
383 a |
384 a |
385 a |
386 a |
387 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b left join a1 a on b.ts = a.ts and a.ts = b.ts1;
388 ts |
389 ==========================
390 __today__ 00:00:00.000 |
391 __today__ 00:00:01.000 |
392 __tomorrow__ 00:00:00.000 |
393 __tomorrow__ 00:00:02.000 |
394 taos> select tb.val,tb.tg1,ta.* from (select now() 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;
395 val | tg1 | ts | val | tg1 |
396 ==================================================================================
397 404 | 1 | NULL | NULL | NULL |
398 taos> select tb.val,tb.tg2,ta.* from (select now() 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;
399 val | tg2 | ts | val | tg2 |
400 ==================================================================================
401 304 | 1 | NULL | NULL | NULL |
402 404 | 2 | NULL | NULL | NULL |
403 taos> select tb.val,tb.tg2,ta.* from (select now() 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;
404 val | tg2 | ts | val | tg2 |
405 ==================================================================================
406 301 | 1 | NULL | NULL | NULL |
407 302 | 1 | NULL | NULL | NULL |
408 303 | 1 | NULL | NULL | NULL |
409 304 | 1 | NULL | NULL | NULL |
410 401 | 2 | NULL | NULL | NULL |
411 402 | 2 | NULL | NULL | NULL |
412 403 | 2 | NULL | NULL | NULL |
413 404 | 2 | NULL | NULL | NULL |
414 taos> select tb.val,tb.tg2,ta.* from (select now() 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=now() where tb.ts=now() order by tb.val;
415 val | tg2 | ts | val | tg2 |
416 ==================================================================================
417 301 | 1 | NULL | NULL | NULL |
418 302 | 1 | NULL | NULL | NULL |
419 303 | 1 | NULL | NULL | NULL |
420 304 | 1 | NULL | NULL | NULL |
421 401 | 2 | NULL | NULL | NULL |
422 402 | 2 | NULL | NULL | NULL |
423 403 | 2 | NULL | NULL | NULL |
424 404 | 2 | NULL | NULL | NULL |
425 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb 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>now() where tb.ts>now();

View File

@ -118,18 +118,32 @@ class TDTestCase(TBase):
def test_constts_case(self, testCase): def test_constts_case(self, testCase):
tdLog.printNoPrefix(f"==========step:{testCase} + ts:{self.today_ts} test") tdLog.printNoPrefix(f"==========step:{testCase} + ts:{self.today_ts} test")
self.replace_string(f'{testCase}.constts.in', f'{testCase}.constts.in.tmp1', '__today__', f'"{self.today_ts}"') self.replace_string(f'{testCase}.constts.in', f'{testCase}.constts.in.tmp1', '__today__', f'"{self.today_ts}"')
self.replace_string(f'{testCase}.constts.csv', f'{testCase}.constts.csv.tmp1', '__today__', f'{self.today_date}')
self.replace_string2(f'{testCase}.constts.csv.tmp1', f'{testCase}.constts.csv.tmp2', '__tomorrow__', f'{self.tomorrow_date}')
# read sql from .sql file and execute # read sql from .sql file and execute
self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.constts.in.tmp1") self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.constts.in.tmp1")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today_ts.csv") self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.constts.csv.tmp2")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
tdLog.printNoPrefix(f"==========step:{testCase} + ts:{self.tomorrow_ts} test") tdLog.printNoPrefix(f"==========step:{testCase} + ts:{self.tomorrow_ts} test")
self.replace_string(f'{testCase}.constts.in', f'{testCase}.constts.in.tmp2', '__today__', f'"{self.tomorrow_ts}"') self.replace_string(f'{testCase}.constts.in', f'{testCase}.constts2.in.tmp2', '__today__', f'"{self.tomorrow_ts}"')
self.replace_string(f'{testCase}.constts2.csv', f'{testCase}.constts2.csv.tmp1', '__today__', f'{self.today_date}')
self.replace_string2(f'{testCase}.constts2.csv.tmp1', f'{testCase}.constts2.csv.tmp2', '__tomorrow__', f'{self.tomorrow_date}')
# read sql from .sql file and execute # read sql from .sql file and execute
self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.constts.in.tmp2") self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.constts2.in.tmp2")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.tomorrow_ts.csv") self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.constts2.csv.tmp2")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
tdLog.printNoPrefix(f"==========step:{testCase} + ts:{self.today_ts} + 1s test")
self.replace_string(f'{testCase}.constts.in', f'{testCase}.constts3.in.tmp1', '__today__', f'"{self.today_ts}" + 1s')
self.replace_string(f'{testCase}.constts3.csv', f'{testCase}.constts3.csv.tmp1', '__today__', f'{self.today_date}')
self.replace_string2(f'{testCase}.constts3.csv.tmp1', f'{testCase}.constts3.csv.tmp2', '__tomorrow__', f'{self.tomorrow_date}')
# read sql from .sql file and execute
self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.constts3.in.tmp1")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.constts3.csv.tmp2")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
def test_nocheck_case(self): def test_nocheck_case(self):
tdLog.printNoPrefix(f"==========step:nocheck test") tdLog.printNoPrefix(f"==========step:nocheck test")
tdSql.execute("select * from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;") tdSql.execute("select * from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;")
@ -146,7 +160,8 @@ class TDTestCase(TBase):
def test_abnormal_case(self): def test_abnormal_case(self):
tdLog.printNoPrefix(f"==========step:abnormal case test") tdLog.printNoPrefix(f"==========step:abnormal case test")
tdSql.error("select interp(c1) from test.td32727 range('2020-02-01 00:00:00.000', '2020-02-01 00:00:30.000', -1s) every(2s) fill(prev, 99);") tdSql.error(f"select * from a1 a join (select '{self.today_ts}' as ts from b1) b on a.ts = b.ts;")
tdSql.error(f"select * from a1 a join (select '{self.today_ts}' + 1s as ts from b1) b on a.ts = b.ts;")
def run(self): def run(self):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
@ -155,11 +170,12 @@ class TDTestCase(TBase):
self.test_today_case("inner") self.test_today_case("inner")
self.test_now_case("inner") self.test_now_case("inner")
#self.test_constts_case("inner") self.test_constts_case("inner")
self.test_today_case("left_outer") self.test_today_case("left_outer")
self.test_now_case("left_outer")
#self.test_abnormal_case() self.test_abnormal_case()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")