fix: constant join issues

This commit is contained in:
dapan1121 2025-03-06 19:27:09 +08:00
parent 5204f97a4b
commit 364381c6f1
17 changed files with 6294 additions and 2011 deletions

View File

@ -118,6 +118,39 @@ static int32_t calcConstCondition(SCalcConstContext* pCxt, SNode** pNode) {
return code; return code;
} }
static EDealRes rewriteCalcConstValue(SNode** pNode, void* pContext) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
SCalcConstContext* pCtx = (SCalcConstContext*)pContext;
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*pNode)) {
return DEAL_RES_CONTINUE;
} else if (QUERY_NODE_OPERATOR == nodeType(*pNode)) {
SOperatorNode* pOp = (SOperatorNode*)*pNode;
if (OP_TYPE_EQUAL == pOp->opType && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode*)pOp->pLeft)->resType.type || TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode*)pOp->pRight)->resType.type)) {
code = calcConstNode(&pOp->pLeft);
if (TSDB_CODE_SUCCESS == code) {
code = calcConstNode(&pOp->pRight);
}
goto _end;
}
}
if (TSDB_CODE_SUCCESS == code) {
code = calcConstCondition(pCtx, pNode);
}
_end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
return DEAL_RES_ERROR;
}
return DEAL_RES_IGNORE_CHILD;
}
static int32_t rewriteConditionForFromTable(SCalcConstContext* pCxt, SNode* pTable) { static int32_t rewriteConditionForFromTable(SCalcConstContext* pCxt, SNode* pTable) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
switch (nodeType(pTable)) { switch (nodeType(pTable)) {
@ -132,6 +165,14 @@ static int32_t rewriteConditionForFromTable(SCalcConstContext* pCxt, SNode* pTab
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = rewriteConditionForFromTable(pCxt, pJoin->pRight); code = rewriteConditionForFromTable(pCxt, pJoin->pRight);
} }
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pOnCond) {
code = rewriteCondition(pCxt, &pJoin->pOnCond);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pOnCond) {
nodesRewriteExpr(&pJoin->pOnCond, rewriteCalcConstValue, pCxt);
}
/*
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pOnCond) { if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pOnCond) {
code = nodesCloneNode(pJoin->pOnCond, &pCond); code = nodesCloneNode(pJoin->pOnCond, &pCond);
} }
@ -142,18 +183,9 @@ static int32_t rewriteConditionForFromTable(SCalcConstContext* pCxt, SNode* pTab
nodesDestroyNode(pJoin->pOnCond); nodesDestroyNode(pJoin->pOnCond);
pJoin->pOnCond = pCond; pJoin->pOnCond = pCond;
pCond = NULL; pCond = NULL;
/* TODO
SValueNode* pVal = (SValueNode*)pJoin->pOnCond;
if (TSDB_DATA_TYPE_BOOL == pVal->node.resType.type) {
if (pVal->datum.b) {
pJoin->condAlwaysTrue = true;
} else {
pJoin->condAlwaysFalse = true;
}
}
*/
} }
nodesDestroyNode(pCond); nodesDestroyNode(pCond);
*/
// todo empty table // todo empty table
break; break;
} }

View File

@ -5107,21 +5107,34 @@ int32_t mergeInnerJoinConds(SNode** ppDst, SNode** ppSrc) {
while (true) { while (true) {
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppDst) && ((SLogicConditionNode*)*ppDst)->condType == LOGIC_COND_TYPE_AND) { if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppDst) && ((SLogicConditionNode*)*ppDst)->condType == LOGIC_COND_TYPE_AND) {
SLogicConditionNode* pLogic = (SLogicConditionNode*)*ppDst; SLogicConditionNode* pLogic = (SLogicConditionNode*)*ppDst;
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc) && ((SLogicConditionNode*)*ppSrc)->condType == LOGIC_COND_TYPE_AND) {
SLogicConditionNode* pSrcLogic = (SLogicConditionNode*)*ppSrc;
code = nodesListMakeStrictAppendList(&pLogic->pParameterList, pSrcLogic->pParameterList);
if (TSDB_CODE_SUCCESS == code) {
pSrcLogic->pParameterList = NULL;
nodesDestroyNode(*ppSrc);
*ppSrc = NULL;
}
} else {
code = nodesListMakeStrictAppend(&pLogic->pParameterList, *ppSrc); code = nodesListMakeStrictAppend(&pLogic->pParameterList, *ppSrc);
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
*ppSrc = NULL; *ppSrc = NULL;
} }
}
return code; return code;
} }
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc) && ((SLogicConditionNode*)*ppSrc)->condType == LOGIC_COND_TYPE_AND) { if (TSDB_CODE_SUCCESS == code && QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc) && ((SLogicConditionNode*)*ppSrc)->condType == LOGIC_COND_TYPE_AND) {
SNode* pTmp = *ppDst; SNode* pTmp = *ppDst;
*ppDst = *ppSrc; *ppDst = *ppSrc;
*ppSrc = pTmp; *ppSrc = pTmp;
continue; continue;
} }
if (TSDB_CODE_SUCCESS == code) {
code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, &pNew); code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, &pNew);
}
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
SLogicConditionNode* pLogic = (SLogicConditionNode*)pNew; SLogicConditionNode* pLogic = (SLogicConditionNode*)pNew;
pLogic->condType = LOGIC_COND_TYPE_AND; pLogic->condType = LOGIC_COND_TYPE_AND;
@ -5229,7 +5242,7 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, bool inJoin) {
if (TSDB_CODE_SUCCESS == code) { if (TSDB_CODE_SUCCESS == code) {
code = checkJoinTable(pCxt, pJoinTable); code = checkJoinTable(pCxt, pJoinTable);
} }
if (TSDB_CODE_SUCCESS == code && pCurrSmt->pWhere && JOIN_TYPE_INNER == pJoinTable->joinType) { if (TSDB_CODE_SUCCESS == code && !inJoin && pCurrSmt->pWhere && JOIN_TYPE_INNER == pJoinTable->joinType) {
if (pJoinTable->pOnCond) { if (pJoinTable->pOnCond) {
code = mergeInnerJoinConds(&pJoinTable->pOnCond, &pCurrSmt->pWhere); code = mergeInnerJoinConds(&pJoinTable->pOnCond, &pCurrSmt->pWhere);
} else { } else {

View File

@ -946,7 +946,7 @@ static int32_t pdcJoinSplitPrimInLogicCond(SJoinLogicNode* pJoin, SNode** ppInpu
SNode* pCond = NULL; SNode* pCond = NULL;
WHERE_EACH(pCond, pLogicCond->pParameterList) { WHERE_EACH(pCond, pLogicCond->pParameterList) {
SNode* pNew = NULL; SNode* pNew = NULL;
if (pdcJoinIsPrimEqualCond(pJoin, pCond, constAsPrim) && (NULL == *ppPrimEqCond)) { if (pdcJoinIsPrimEqualCond(pJoin, pCond, constAsPrim) && (NULL == *ppPrimEqCond) && (!constAsPrim || pJoin->leftConstPrimGot || pJoin->rightConstPrimGot)) {
code = nodesCloneNode(pCond, &pNew); code = nodesCloneNode(pCond, &pNew);
if (TSDB_CODE_SUCCESS != code) break; if (TSDB_CODE_SUCCESS != code) break;
*ppPrimEqCond = pNew; *ppPrimEqCond = pNew;
@ -1446,7 +1446,7 @@ static int32_t pdcJoinSplitConstPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNod
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppCond) && if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppCond) &&
LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)*ppCond)->condType) { LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)*ppCond)->condType) {
code = pdcJoinSplitPrimInLogicCond(pJoin, ppCond, &pPrimKeyEqCond, &pJoinOnCond, true); code = pdcJoinSplitPrimInLogicCond(pJoin, ppCond, &pPrimKeyEqCond, &pJoinOnCond, true);
} else if (pdcJoinIsPrimEqualCond(pJoin, *ppCond, true)) { } else if (pdcJoinIsPrimEqualCond(pJoin, *ppCond, true) && (pJoin->leftConstPrimGot || pJoin->rightConstPrimGot)) {
pPrimKeyEqCond = *ppCond; pPrimKeyEqCond = *ppCond;
pJoinOnCond = NULL; pJoinOnCond = NULL;
} else { } else {
@ -1512,7 +1512,7 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin
if (pJoin->leftNoOrderedSubQuery || pJoin->rightNoOrderedSubQuery || !primCondGot) { if (pJoin->leftNoOrderedSubQuery || pJoin->rightNoOrderedSubQuery || !primCondGot) {
pJoin->noPrimKeyEqCond = true; pJoin->noPrimKeyEqCond = true;
int32_t code = pdcJoinSplitConstPrimEqCond(pCxt, pJoin, ppCond); int32_t code = pdcJoinSplitConstPrimEqCond(pCxt, pJoin, ppCond);
if (code || pJoin->pPrimKeyEqCond) { if (code || (pJoin->pPrimKeyEqCond)) {
return code; return code;
} }

View File

@ -1057,12 +1057,12 @@ static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_
return code; return code;
} }
static int32_t removePrimColFromJoinTargets(SNodeList* pTargets, SValueNode* pLeftPrimExpr, SColumnNode** ppRemoved) { static int32_t removePrimColFromJoinTargets(SNodeList* pTargets, SValueNode* pPrimExpr, SColumnNode** ppRemoved) {
int32_t code = TSDB_CODE_SUCCESS; int32_t code = TSDB_CODE_SUCCESS;
SNode* pNode = NULL; SNode* pNode = NULL;
FOREACH(pNode, pTargets) { FOREACH(pNode, pTargets) {
SColumnNode* pCol = (SColumnNode*)pNode; SColumnNode* pCol = (SColumnNode*)pNode;
if (0 == strcmp(pCol->tableAlias, pLeftPrimExpr->node.srcTable) && 0 == strcmp(pCol->colName, pLeftPrimExpr->node.aliasName)) { if (0 == strcmp(pCol->tableAlias, pPrimExpr->node.srcTable) && 0 == strcmp(pCol->colName, pPrimExpr->node.aliasName)) {
code = nodesCloneNode(pNode, (SNode**)ppRemoved); code = nodesCloneNode(pNode, (SNode**)ppRemoved);
ERASE_NODE(pTargets); ERASE_NODE(pTargets);
break; break;

View File

@ -0,0 +1,377 @@
taos> use test;
Database changed.
taos> select * from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
taos> select * from a1 a join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
taos> select a.* from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
taos> select b.* from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
taos> select b.* from a1 a join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
taos> select a.*, b.ts from a1 a join (select now as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
taos> select b.c from a1 a join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
taos> select b.ts from a1 a join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
taos> select * from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__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 join (select now as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__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 join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__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 now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select * from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.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 join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a 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 join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select * from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
taos> select * from (select now as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
taos> select a.* from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
taos> select b.* from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
taos> select b.* from (select now as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
taos> select b.c from (select now as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
taos> select b.ts from (select now as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__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 join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
taos> select * from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
taos> select * from a1 a , (select now as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
taos> select a.* from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
taos> select b.* from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
taos> select b.c from a1 a , (select now as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
taos> select b.ts from a1 a , (select now as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
taos> select b.ts1 from a1 a , (select now as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
taos> select * from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
taos> select b.ts1 from a1 a , (select now as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__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 , (select now as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
__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 now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select * from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now 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 now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now 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 now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now ;
taos> select * from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
taos> select * from (select now as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
taos> select a.* from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
taos> select b.* from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
taos> select b.c from (select now as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
taos> select b.ts from (select now as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__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 , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now order by tb.val;
taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now ;
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
4 taos> select * from a1 a join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
5 taos> select a.* from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
6 taos> select b.* from a1 a join (select now as ts, f, g, 'a' from b1) b on a.ts = b.ts;
7 taos> select b.* from a1 a join (select now as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
8 taos> select a.*, b.ts from a1 a join (select now as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
9 taos> select b.c from a1 a join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
10 taos> select b.ts from a1 a join (select now as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
11 taos> select * from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
12 taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
13 taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
14 taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
15 taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
16 ts | f | g |
17 ======================================================
18 __today__ 00:00:00.000 | 101 | 1011 |
19 __today__ 00:00:01.000 | 102 | 1012 |
20 __tomorrow__ 00:00:00.000 | 103 | 1013 |
21 __tomorrow__ 00:00:02.000 | 104 | 1014 |
22 taos> select b.ts1,a.ts from a1 a join (select now as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
23 taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
24 ts | f | g |
25 ======================================================
26 __today__ 00:00:00.000 | 101 | 1011 |
27 __today__ 00:00:01.000 | 102 | 1012 |
28 __tomorrow__ 00:00:00.000 | 103 | 1013 |
29 __tomorrow__ 00:00:02.000 | 104 | 1014 |
30 taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
31 c |
32 ======
33 a |
34 a |
35 a |
36 a |
37 taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
38 ts |
39 ==========================
40 __today__ 00:00:00.000 |
41 __today__ 00:00:01.000 |
42 __tomorrow__ 00:00:00.000 |
43 __tomorrow__ 00:00:02.000 |
44 taos> select * from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
45 taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
46 taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
47 taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
48 taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
49 taos> select * from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
50 taos> select a.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
51 taos> select b.* from a1 a join (select now as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
52 taos> select b.c from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
53 taos> select b.ts from a1 a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
54 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
55 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
56 ts |
57 ==========================
58 __today__ 00:00:00.000 |
59 __today__ 00:00:01.000 |
60 __tomorrow__ 00:00:00.000 |
61 __tomorrow__ 00:00:02.000 |
62 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
63 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
64 ts |
65 ==========================
66 __today__ 00:00:00.000 |
67 __today__ 00:00:01.000 |
68 __tomorrow__ 00:00:00.000 |
69 __tomorrow__ 00:00:02.000 |
70 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
71 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
72 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
73 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
74 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
75 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
76 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
77 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;
78 ts | val | tg2 | ts | val | tg2 |
79 ============================================================================================================
80 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
81 taos> select * from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
82 taos> select * from (select now as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
83 taos> select a.* from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
84 taos> select b.* from (select now as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
85 taos> select b.* from (select now as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
86 taos> select b.c from (select now as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
87 taos> select b.ts from (select now as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
88 taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
89 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
90 taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
91 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
92 taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
93 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
94 ts | f | g |
95 ======================================================
96 __today__ 00:00:00.000 | 101 | 1011 |
97 __today__ 00:00:01.000 | 102 | 1012 |
98 __tomorrow__ 00:00:00.000 | 103 | 1013 |
99 __tomorrow__ 00:00:02.000 | 104 | 1014 |
100 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
101 c |
102 ======
103 a |
104 a |
105 a |
106 a |
107 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
108 ts |
109 ==========================
110 __today__ 00:00:00.000 |
111 __today__ 00:00:01.000 |
112 __tomorrow__ 00:00:00.000 |
113 __tomorrow__ 00:00:02.000 |
114 taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
115 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
116 taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
117 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
118 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
119 taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
120 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
121 taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
122 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
123 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
124 taos> select * from (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
125 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
126 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
127 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now where tb.ts=now order by tb.val;
128 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now where tb.ts>now;
129 taos> select * from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
130 taos> select * from a1 a , (select now as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
131 taos> select a.* from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
132 taos> select b.* from a1 a , (select now as ts, f, g, 'a' from b1) b where a.ts = b.ts;
133 taos> select b.c from a1 a , (select now as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
134 taos> select b.ts from a1 a , (select now as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
135 taos> select b.ts1 from a1 a , (select now as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
136 taos> select * from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
137 taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
138 taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
139 taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
140 taos> select b.ts1 from a1 a , (select now as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
141 taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
142 ts | f | g |
143 ======================================================
144 __today__ 00:00:00.000 | 101 | 1011 |
145 __today__ 00:00:01.000 | 102 | 1012 |
146 __tomorrow__ 00:00:00.000 | 103 | 1013 |
147 __tomorrow__ 00:00:02.000 | 104 | 1014 |
148 taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
149 c |
150 ======
151 a |
152 a |
153 a |
154 a |
155 taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
156 ts |
157 ==========================
158 __today__ 00:00:00.000 |
159 __today__ 00:00:01.000 |
160 __tomorrow__ 00:00:00.000 |
161 __tomorrow__ 00:00:02.000 |
162 taos> select * from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
163 taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
164 taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
165 taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
166 taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
167 taos> select * from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
168 taos> select a.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
169 taos> select b.* from a1 a , (select now as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
170 taos> select b.c from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
171 taos> select b.ts from a1 a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
172 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
173 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
174 ts |
175 ==========================
176 __today__ 00:00:00.000 |
177 __today__ 00:00:01.000 |
178 __tomorrow__ 00:00:00.000 |
179 __tomorrow__ 00:00:02.000 |
180 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
181 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
182 ts |
183 ==========================
184 __today__ 00:00:00.000 |
185 __today__ 00:00:01.000 |
186 __tomorrow__ 00:00:00.000 |
187 __tomorrow__ 00:00:02.000 |
188 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
189 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
190 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
191 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
192 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now order by tb.val;
193 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now ;
194 taos> select * from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
195 taos> select * from (select now as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
196 taos> select a.* from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
197 taos> select b.* from (select now as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
198 taos> select b.c from (select now as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
199 taos> select b.ts from (select now as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
200 taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
201 taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
202 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
203 taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
204 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
205 taos> select b.ts1 from (select now as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
206 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
207 ts | f | g |
208 ======================================================
209 __today__ 00:00:00.000 | 101 | 1011 |
210 __today__ 00:00:01.000 | 102 | 1012 |
211 __tomorrow__ 00:00:00.000 | 103 | 1013 |
212 __tomorrow__ 00:00:02.000 | 104 | 1014 |
213 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
214 c |
215 ======
216 a |
217 a |
218 a |
219 a |
220 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
221 ts |
222 ==========================
223 __today__ 00:00:00.000 |
224 __today__ 00:00:01.000 |
225 __tomorrow__ 00:00:00.000 |
226 __tomorrow__ 00:00:02.000 |
227 taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
228 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
229 taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
230 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
231 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
232 taos> select * from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
233 taos> select a.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
234 taos> select b.* from (select now as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
235 taos> select b.c from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
236 taos> select b.ts from (select now as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
237 taos> select * from (select now ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
238 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
239 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
240 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now order by tb.val;
241 taos> select * from (select now ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now ;

View File

@ -0,0 +1,143 @@
use test;
select * from a1 a join (select __const__ as ts, f, g, 'a' from b1) b on a.ts = b.ts;
select * from a1 a join (select __const__ as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
select a.* from a1 a join (select __const__ as ts, f, g, 'a' from b1) b on a.ts = b.ts;
select b.* from a1 a join (select __const__ as ts, f, g, 'a' from b1) b on a.ts = b.ts;
select b.* from a1 a join (select __const__ as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
select a.*, b.ts from a1 a join (select __const__ as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
select b.c from a1 a join (select __const__ as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
select b.ts from a1 a join (select __const__ as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
select * from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
select a.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
select b.c from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
select a.* from a1 a 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 join (select __const__ as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
select a.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
select b.c from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
select b.ts from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
select * from a1 a 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 __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 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 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 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 __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 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 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 __const__ as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
select * from (select __const__ as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
select a.* from (select __const__ as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
select b.* from (select __const__ as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
select b.* from (select __const__ as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
select b.c from (select __const__ as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
select b.ts from (select __const__ as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
select a.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
select b.c from (select __const__ as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
select b.ts1 from (select __const__ as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
select a.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
select b.c from (select __const__ as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
select * from (select __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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=__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 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__;
select * from a1 a , (select __const__ as ts, f, g, 'a' from b1) b where a.ts = b.ts;
select * from a1 a , (select __const__ as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
select a.* from a1 a , (select __const__ as ts, f, g, 'a' from b1) b where a.ts = b.ts;
select b.* from a1 a , (select __const__ as ts, f, g, 'a' from b1) b where a.ts = b.ts;
select b.c from a1 a , (select __const__ as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
select b.ts from a1 a , (select __const__ as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
select b.ts1 from a1 a , (select __const__ as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
select * from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
select a.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
select b.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
select b.c from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
select b.ts1 from a1 a , (select __const__ as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
select a.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
select b.c from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
select b.ts from a1 a , (select __const__ as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
select * from a1 a , (select __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ as ts1, ts, f, g, 'a' c from a1) a , (select __const__ 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 __const__ as ts1, ts, f, g, 'a' c from a1) a , (select __const__ 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 __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ 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 __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ 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 __const__ as ts1, ts, f, g, 'a' c from a1 order by f) a , (select __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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=__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 , (select __const__ 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>__const__ ;
select * from (select __const__ as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
select * from (select __const__ as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
select a.* from (select __const__ as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
select b.* from (select __const__ as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
select b.c from (select __const__ as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
select b.ts from (select __const__ as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
select b.ts1 from (select __const__ as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
select a.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
select b.c from (select __const__ as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
select b.ts1 from (select __const__ as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
select a.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
select b.c from (select __const__ as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
select b.ts from (select __const__ as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
select * from (select __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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 __const__ 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=__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 , (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>__const__ ;

View File

@ -0,0 +1,377 @@
taos> use test;
Database changed.
taos> select * from a1 a join (select now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
taos> select * from a1 a join (select now() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
taos> select a.* from a1 a join (select now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
taos> select b.* from a1 a join (select now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
taos> select b.* from a1 a join (select now() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
taos> select a.*, b.ts from a1 a join (select now() as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
taos> select b.c from a1 a join (select now() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
taos> select b.ts from a1 a join (select now() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
taos> select * from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
taos> select b.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__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 join (select now() as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__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 join (select now() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
__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 now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
taos> select * from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.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 join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a 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 join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now();
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select * from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
taos> select * from (select now() as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
taos> select a.* from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
taos> select b.* from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
taos> select b.* from (select now() as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
taos> select b.c from (select now() as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
taos> select b.ts from (select now() as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
taos> select b.ts1 from (select now() as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__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 join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now();
taos> select * from a1 a , (select now() as ts, f, g, 'a' from b1) b where a.ts = b.ts;
taos> select * from a1 a , (select now() as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
taos> select a.* from a1 a , (select now() as ts, f, g, 'a' from b1) b where a.ts = b.ts;
taos> select b.* from a1 a , (select now() as ts, f, g, 'a' from b1) b where a.ts = b.ts;
taos> select b.c from a1 a , (select now() as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
taos> select b.ts from a1 a , (select now() as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
taos> select b.ts1 from a1 a , (select now() as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
taos> select * from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
taos> select a.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
taos> select b.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
taos> select b.c from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
taos> select b.ts1 from a1 a , (select now() as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
taos> select a.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__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 , (select now() as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
__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 now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select a.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.c from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
taos> select * from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select a.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.c from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() 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 now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() 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 now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() ;
taos> select * from (select now() as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
taos> select * from (select now() as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
taos> select a.* from (select now() as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
taos> select b.* from (select now() as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
taos> select b.c from (select now() as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
taos> select b.ts from (select now() as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
taos> select b.ts1 from (select now() as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
taos> select b.ts1 from (select now() as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__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 , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() order by tb.val;
taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() ;
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a join (select now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
4 taos> select * from a1 a join (select now() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
5 taos> select a.* from a1 a join (select now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
6 taos> select b.* from a1 a join (select now() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
7 taos> select b.* from a1 a join (select now() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
8 taos> select a.*, b.ts from a1 a join (select now() as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
9 taos> select b.c from a1 a join (select now() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
10 taos> select b.ts from a1 a join (select now() as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
11 taos> select * from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
12 taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
13 taos> select b.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
14 taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
15 taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
16 ts | f | g |
17 ======================================================
18 __today__ 00:00:00.000 | 101 | 1011 |
19 __today__ 00:00:01.000 | 102 | 1012 |
20 __tomorrow__ 00:00:00.000 | 103 | 1013 |
21 __tomorrow__ 00:00:02.000 | 104 | 1014 |
22 taos> select b.ts1,a.ts from a1 a join (select now() as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
23 taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
24 ts | f | g |
25 ======================================================
26 __today__ 00:00:00.000 | 101 | 1011 |
27 __today__ 00:00:01.000 | 102 | 1012 |
28 __tomorrow__ 00:00:00.000 | 103 | 1013 |
29 __tomorrow__ 00:00:02.000 | 104 | 1014 |
30 taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
31 c |
32 ======
33 a |
34 a |
35 a |
36 a |
37 taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
38 ts |
39 ==========================
40 __today__ 00:00:00.000 |
41 __today__ 00:00:01.000 |
42 __tomorrow__ 00:00:00.000 |
43 __tomorrow__ 00:00:02.000 |
44 taos> select * from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
45 taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
46 taos> select b.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
47 taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
48 taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
49 taos> select * from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
50 taos> select a.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
51 taos> select b.* from a1 a join (select now() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
52 taos> select b.c from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
53 taos> select b.ts from a1 a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
54 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
55 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
56 ts |
57 ==========================
58 __today__ 00:00:00.000 |
59 __today__ 00:00:01.000 |
60 __tomorrow__ 00:00:00.000 |
61 __tomorrow__ 00:00:02.000 |
62 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
63 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
64 ts |
65 ==========================
66 __today__ 00:00:00.000 |
67 __today__ 00:00:01.000 |
68 __tomorrow__ 00:00:00.000 |
69 __tomorrow__ 00:00:02.000 |
70 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
71 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
72 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
73 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
74 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
75 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;
76 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now();
77 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;
78 ts | val | tg2 | ts | val | tg2 |
79 ============================================================================================================
80 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
81 taos> select * from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
82 taos> select * from (select now() as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
83 taos> select a.* from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
84 taos> select b.* from (select now() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
85 taos> select b.* from (select now() as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
86 taos> select b.c from (select now() as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
87 taos> select b.ts from (select now() as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
88 taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
89 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
90 taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
91 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
92 taos> select b.ts1 from (select now() as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
93 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
94 ts | f | g |
95 ======================================================
96 __today__ 00:00:00.000 | 101 | 1011 |
97 __today__ 00:00:01.000 | 102 | 1012 |
98 __tomorrow__ 00:00:00.000 | 103 | 1013 |
99 __tomorrow__ 00:00:02.000 | 104 | 1014 |
100 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
101 c |
102 ======
103 a |
104 a |
105 a |
106 a |
107 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
108 ts |
109 ==========================
110 __today__ 00:00:00.000 |
111 __today__ 00:00:01.000 |
112 __tomorrow__ 00:00:00.000 |
113 __tomorrow__ 00:00:02.000 |
114 taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
115 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
116 taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
117 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
118 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
119 taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
120 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
121 taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
122 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
123 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
124 taos> select * from (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
125 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
126 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
127 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() where tb.ts=now() order by tb.val;
128 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() where tb.ts>now();
129 taos> select * from a1 a , (select now() as ts, f, g, 'a' from b1) b where a.ts = b.ts;
130 taos> select * from a1 a , (select now() as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
131 taos> select a.* from a1 a , (select now() as ts, f, g, 'a' from b1) b where a.ts = b.ts;
132 taos> select b.* from a1 a , (select now() as ts, f, g, 'a' from b1) b where a.ts = b.ts;
133 taos> select b.c from a1 a , (select now() as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
134 taos> select b.ts from a1 a , (select now() as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
135 taos> select b.ts1 from a1 a , (select now() as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
136 taos> select * from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
137 taos> select a.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
138 taos> select b.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
139 taos> select b.c from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
140 taos> select b.ts1 from a1 a , (select now() as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
141 taos> select a.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
142 ts | f | g |
143 ======================================================
144 __today__ 00:00:00.000 | 101 | 1011 |
145 __today__ 00:00:01.000 | 102 | 1012 |
146 __tomorrow__ 00:00:00.000 | 103 | 1013 |
147 __tomorrow__ 00:00:02.000 | 104 | 1014 |
148 taos> select b.c from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
149 c |
150 ======
151 a |
152 a |
153 a |
154 a |
155 taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
156 ts |
157 ==========================
158 __today__ 00:00:00.000 |
159 __today__ 00:00:01.000 |
160 __tomorrow__ 00:00:00.000 |
161 __tomorrow__ 00:00:02.000 |
162 taos> select * from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
163 taos> select a.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
164 taos> select b.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
165 taos> select b.c from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
166 taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
167 taos> select * from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
168 taos> select a.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
169 taos> select b.* from a1 a , (select now() as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
170 taos> select b.c from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
171 taos> select b.ts from a1 a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
172 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
173 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
174 ts |
175 ==========================
176 __today__ 00:00:00.000 |
177 __today__ 00:00:01.000 |
178 __tomorrow__ 00:00:00.000 |
179 __tomorrow__ 00:00:02.000 |
180 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
181 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
182 ts |
183 ==========================
184 __today__ 00:00:00.000 |
185 __today__ 00:00:01.000 |
186 __tomorrow__ 00:00:00.000 |
187 __tomorrow__ 00:00:02.000 |
188 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select now() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
189 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
190 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
191 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
192 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() order by tb.val;
193 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() ;
194 taos> select * from (select now() as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
195 taos> select * from (select now() as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
196 taos> select a.* from (select now() as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
197 taos> select b.* from (select now() as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
198 taos> select b.c from (select now() as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
199 taos> select b.ts from (select now() as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
200 taos> select b.ts1 from (select now() as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
201 taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
202 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
203 taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
204 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
205 taos> select b.ts1 from (select now() as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
206 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
207 ts | f | g |
208 ======================================================
209 __today__ 00:00:00.000 | 101 | 1011 |
210 __today__ 00:00:01.000 | 102 | 1012 |
211 __tomorrow__ 00:00:00.000 | 103 | 1013 |
212 __tomorrow__ 00:00:02.000 | 104 | 1014 |
213 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
214 c |
215 ======
216 a |
217 a |
218 a |
219 a |
220 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
221 ts |
222 ==========================
223 __today__ 00:00:00.000 |
224 __today__ 00:00:01.000 |
225 __tomorrow__ 00:00:00.000 |
226 __tomorrow__ 00:00:02.000 |
227 taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
228 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
229 taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
230 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
231 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
232 taos> select * from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
233 taos> select a.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
234 taos> select b.* from (select now() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
235 taos> select b.c from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
236 taos> select b.ts from (select now() as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
237 taos> select * from (select now() ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
238 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
239 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
240 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=now() order by tb.val;
241 taos> select * from (select now() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>now() ;

File diff suppressed because it is too large Load Diff

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -0,0 +1,969 @@
taos> use test;
Database changed.
taos> select * from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | ts | f | g | 'a' |
==================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select * from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select a.*, b.ts from a1 a join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts |
================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 |
taos> select b.c from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g | ts1 | ts | f | g | c |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 |
taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select * from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
ts1 |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today;
taos> select * from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts | f | g | 'a' |
==================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select * from a1 a , (select today as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
ts1 |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
ts1 |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ;
taos> select * from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select * from (select today as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
ts1 |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
ts1 |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
======================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ;
1 taos> use test;
2 Database changed.
3 taos> select * from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
4 ts | f | g | ts | f | g | 'a' |
5 ==================================================================================================================
6 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
7 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
8 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
9 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
10 taos> select * from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
11 ts | f | g | ts1 | f | g | 'a' |
12 ==================================================================================================================
13 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
14 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
15 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
16 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
17 taos> select a.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
18 ts | f | g |
19 ======================================================
20 2025-03-04 00:00:00.000 | 101 | 1011 |
21 2025-03-04 00:00:00.000 | 101 | 1011 |
22 2025-03-04 00:00:00.000 | 101 | 1011 |
23 2025-03-04 00:00:00.000 | 101 | 1011 |
24 taos> select b.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
25 ts | f | g | 'a' |
26 ============================================================
27 2025-03-04 00:00:00.000 | 301 | 3011 | a |
28 2025-03-04 00:00:00.000 | 302 | 3012 | a |
29 2025-03-04 00:00:00.000 | 303 | 3013 | a |
30 2025-03-04 00:00:00.000 | 304 | 3014 | a |
31 taos> select b.* from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
32 ts1 | f | g | 'a' |
33 ============================================================
34 2025-03-04 00:00:00.000 | 301 | 3011 | a |
35 2025-03-04 00:00:00.000 | 302 | 3012 | a |
36 2025-03-04 00:00:00.000 | 303 | 3013 | a |
37 2025-03-04 00:00:00.000 | 304 | 3014 | a |
38 taos> select a.*, b.ts from a1 a join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
39 ts | f | g | ts |
40 ================================================================================
41 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 |
42 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 |
43 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 |
44 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 |
45 taos> select b.c from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
46 c |
47 ======
48 a |
49 a |
50 a |
51 a |
52 taos> select b.ts from a1 a join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
53 ts |
54 ==========================
55 2025-03-04 00:00:00.000 |
56 2025-03-04 00:00:00.000 |
57 2025-03-04 00:00:00.000 |
58 2025-03-04 00:00:00.000 |
59 taos> select * from a1 a join (select today 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 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
63 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
64 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
65 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
66 taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
67 ts | f | g |
68 ======================================================
69 2025-03-04 00:00:00.000 | 101 | 1011 |
70 2025-03-04 00:00:00.000 | 101 | 1011 |
71 2025-03-04 00:00:00.000 | 101 | 1011 |
72 2025-03-04 00:00:00.000 | 101 | 1011 |
73 taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
74 ts1 | ts | f | g | 'a' |
75 ======================================================================================
76 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
77 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
78 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
79 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
80 taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
81 c |
82 ======
83 a |
84 a |
85 a |
86 a |
87 taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
88 ts | f | g | ts1 | ts | f | g | c |
89 ============================================================================================================================================
90 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
91 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
92 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
93 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
94 taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
95 ts | f | g |
96 ======================================================
97 2025-03-04 00:00:00.000 | 101 | 1011 |
98 2025-03-04 00:00:01.000 | 102 | 1012 |
99 2025-03-05 00:00:00.000 | 103 | 1013 |
100 2025-03-05 00:00:02.000 | 104 | 1014 |
101 taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
102 ts1 | ts | f | g | c |
103 ======================================================================================
104 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
105 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
106 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
107 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
108 taos> select b.ts1,a.ts from a1 a join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
109 ts1 | ts |
110 ====================================================
111 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
112 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
113 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
114 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 |
115 taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
116 ts | f | g | ts1 | ts | f | g | 'a' |
117 ============================================================================================================================================
118 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
119 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
120 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
121 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
122 taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
123 ts | f | g |
124 ======================================================
125 2025-03-04 00:00:00.000 | 101 | 1011 |
126 2025-03-04 00:00:01.000 | 102 | 1012 |
127 2025-03-05 00:00:00.000 | 103 | 1013 |
128 2025-03-05 00:00:02.000 | 104 | 1014 |
129 taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
130 ts1 | ts | f | g | 'a' |
131 ======================================================================================
132 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
133 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
134 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
135 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
136 taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
137 c |
138 ======
139 a |
140 a |
141 a |
142 a |
143 taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
144 ts |
145 ==========================
146 2025-03-04 00:00:00.000 |
147 2025-03-04 00:00:01.000 |
148 2025-03-05 00:00:00.000 |
149 2025-03-05 00:00:02.000 |
150 taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
151 ts | f | g | ts1 | ts | f | g | 'a' |
152 ============================================================================================================================================
153 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
154 taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
155 ts | f | g |
156 ======================================================
157 2025-03-04 00:00:00.000 | 101 | 1011 |
158 taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
159 ts1 | ts | f | g | 'a' |
160 ======================================================================================
161 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
162 taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
163 c |
164 ======
165 a |
166 taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
167 ts |
168 ==========================
169 2025-03-04 00:00:00.000 |
170 taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
171 ts | f | g | ts1 | ts | f | g | 'a' |
172 ============================================================================================================================================
173 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
174 taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
175 ts | f | g |
176 ======================================================
177 2025-03-04 00:00:00.000 | 101 | 1011 |
178 taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
179 ts1 | ts | f | g | 'a' |
180 ======================================================================================
181 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
182 taos> select b.c from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
183 c |
184 ======
185 a |
186 taos> select b.ts from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
187 ts |
188 ==========================
189 2025-03-04 00:00:00.000 |
190 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
191 ts |
192 ==========================
193 2025-03-04 00:00:00.000 |
194 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
195 ts |
196 ==========================
197 2025-03-04 00:00:00.000 |
198 2025-03-04 00:00:01.000 |
199 2025-03-05 00:00:00.000 |
200 2025-03-05 00:00:02.000 |
201 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
202 ts |
203 ==========================
204 2025-03-04 00:00:00.000 |
205 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
206 ts |
207 ==========================
208 2025-03-04 00:00:00.000 |
209 2025-03-04 00:00:01.000 |
210 2025-03-05 00:00:00.000 |
211 2025-03-05 00:00:02.000 |
212 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
213 ts |
214 ==========================
215 2025-03-04 00:00:00.000 |
216 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
217 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
218 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
219 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
220 ts | val | tg2 | ts | val | tg2 |
221 ============================================================================================================
222 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
223 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
224 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
225 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
226 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
227 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
228 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
229 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
230 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
231 ts | val | tg2 | ts | val | tg2 |
232 ============================================================================================================
233 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
234 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
235 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
236 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
237 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
238 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
239 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
240 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
241 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today;
242 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;
243 ts | val | tg2 | ts | val | tg2 |
244 ============================================================================================================
245 2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 |
246 taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
247 ts | f | g | 'a' | ts | f | g |
248 ==================================================================================================================
249 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
250 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
251 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
252 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
253 taos> select * from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
254 ts1 | f | g | 'a' | ts | f | g |
255 ==================================================================================================================
256 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
257 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
258 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
259 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
260 taos> select a.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
261 ts | f | g |
262 ======================================================
263 2025-03-04 00:00:00.000 | 101 | 1011 |
264 2025-03-04 00:00:00.000 | 101 | 1011 |
265 2025-03-04 00:00:00.000 | 101 | 1011 |
266 2025-03-04 00:00:00.000 | 101 | 1011 |
267 taos> select b.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
268 ts | f | g | 'a' |
269 ============================================================
270 2025-03-04 00:00:00.000 | 301 | 3011 | a |
271 2025-03-04 00:00:00.000 | 302 | 3012 | a |
272 2025-03-04 00:00:00.000 | 303 | 3013 | a |
273 2025-03-04 00:00:00.000 | 304 | 3014 | a |
274 taos> select b.* from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
275 ts1 | f | g | 'a' |
276 ============================================================
277 2025-03-04 00:00:00.000 | 301 | 3011 | a |
278 2025-03-04 00:00:00.000 | 302 | 3012 | a |
279 2025-03-04 00:00:00.000 | 303 | 3013 | a |
280 2025-03-04 00:00:00.000 | 304 | 3014 | a |
281 taos> select b.c from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
282 c |
283 ======
284 a |
285 a |
286 a |
287 a |
288 taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
289 ts |
290 ==========================
291 2025-03-04 00:00:00.000 |
292 2025-03-04 00:00:00.000 |
293 2025-03-04 00:00:00.000 |
294 2025-03-04 00:00:00.000 |
295 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
296 ts1 | ts | f | g | 'a' | ts | f | g |
297 ============================================================================================================================================
298 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
299 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
300 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
301 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
302 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
303 ts | f | g |
304 ======================================================
305 2025-03-04 00:00:00.000 | 101 | 1011 |
306 2025-03-04 00:00:00.000 | 101 | 1011 |
307 2025-03-04 00:00:00.000 | 101 | 1011 |
308 2025-03-04 00:00:00.000 | 101 | 1011 |
309 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
310 ts1 | ts | f | g | 'a' |
311 ======================================================================================
312 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
313 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
314 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
315 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
316 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
317 c |
318 ======
319 a |
320 a |
321 a |
322 a |
323 taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
324 ts1 |
325 ==========================
326 2025-03-04 00:00:00.000 |
327 2025-03-04 00:00:00.000 |
328 2025-03-04 00:00:00.000 |
329 2025-03-04 00:00:00.000 |
330 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
331 ts1 | ts | f | g | 'a' | ts | f | g |
332 ============================================================================================================================================
333 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
334 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
335 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
336 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
337 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
338 ts | f | g |
339 ======================================================
340 2025-03-04 00:00:00.000 | 101 | 1011 |
341 2025-03-04 00:00:01.000 | 102 | 1012 |
342 2025-03-05 00:00:00.000 | 103 | 1013 |
343 2025-03-05 00:00:02.000 | 104 | 1014 |
344 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
345 ts1 | ts | f | g | 'a' |
346 ======================================================================================
347 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
348 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
349 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
350 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
351 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
352 c |
353 ======
354 a |
355 a |
356 a |
357 a |
358 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
359 ts |
360 ==========================
361 2025-03-04 00:00:00.000 |
362 2025-03-04 00:00:01.000 |
363 2025-03-05 00:00:00.000 |
364 2025-03-05 00:00:02.000 |
365 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
366 ts1 | ts | f | g | 'a' | ts | f | g |
367 ============================================================================================================================================
368 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
369 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
370 ts | f | g |
371 ======================================================
372 2025-03-04 00:00:00.000 | 101 | 1011 |
373 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
374 ts1 | ts | f | g | 'a' |
375 ======================================================================================
376 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
377 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
378 c |
379 ======
380 a |
381 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
382 ts |
383 ==========================
384 2025-03-04 00:00:00.000 |
385 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
386 ts1 | ts | f | g | 'a' | ts | f | g |
387 ============================================================================================================================================
388 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
389 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
390 ts | f | g |
391 ======================================================
392 2025-03-04 00:00:00.000 | 101 | 1011 |
393 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
394 ts1 | ts | f | g | 'a' |
395 ======================================================================================
396 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
397 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
398 c |
399 ======
400 a |
401 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
402 ts |
403 ==========================
404 2025-03-04 00:00:00.000 |
405 taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
406 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
407 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
408 ts | val | tg2 | ts | val | tg2 |
409 ============================================================================================================
410 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
411 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
412 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
413 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
414 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
415 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
416 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
417 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
418 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
419 ts | val | tg2 | ts | val | tg2 |
420 ============================================================================================================
421 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
422 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
423 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
424 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
425 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
426 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
427 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
428 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
429 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today;
430 taos> select * from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
431 ts | f | g | ts | f | g | 'a' |
432 ==================================================================================================================
433 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
434 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
435 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
436 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
437 taos> select * from a1 a , (select today as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
438 ts | f | g | ts1 | f | g | 'a' |
439 ==================================================================================================================
440 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
441 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 302 | 3012 | a |
442 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 303 | 3013 | a |
443 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 304 | 3014 | a |
444 taos> select a.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
445 ts | f | g |
446 ======================================================
447 2025-03-04 00:00:00.000 | 101 | 1011 |
448 2025-03-04 00:00:00.000 | 101 | 1011 |
449 2025-03-04 00:00:00.000 | 101 | 1011 |
450 2025-03-04 00:00:00.000 | 101 | 1011 |
451 taos> select b.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
452 ts | f | g | 'a' |
453 ============================================================
454 2025-03-04 00:00:00.000 | 301 | 3011 | a |
455 2025-03-04 00:00:00.000 | 302 | 3012 | a |
456 2025-03-04 00:00:00.000 | 303 | 3013 | a |
457 2025-03-04 00:00:00.000 | 304 | 3014 | a |
458 taos> select b.c from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
459 c |
460 ======
461 a |
462 a |
463 a |
464 a |
465 taos> select b.ts from a1 a , (select today as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
466 ts |
467 ==========================
468 2025-03-04 00:00:00.000 |
469 2025-03-04 00:00:00.000 |
470 2025-03-04 00:00:00.000 |
471 2025-03-04 00:00:00.000 |
472 taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
473 ts1 |
474 ==========================
475 2025-03-04 00:00:00.000 |
476 2025-03-04 00:00:00.000 |
477 2025-03-04 00:00:00.000 |
478 2025-03-04 00:00:00.000 |
479 taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
480 ts | f | g | ts1 | ts | f | g | 'a' |
481 ============================================================================================================================================
482 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
483 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
484 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
485 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
486 taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
487 ts | f | g |
488 ======================================================
489 2025-03-04 00:00:00.000 | 101 | 1011 |
490 2025-03-04 00:00:00.000 | 101 | 1011 |
491 2025-03-04 00:00:00.000 | 101 | 1011 |
492 2025-03-04 00:00:00.000 | 101 | 1011 |
493 taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
494 ts1 | ts | f | g | 'a' |
495 ======================================================================================
496 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
497 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
498 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
499 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
500 taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
501 c |
502 ======
503 a |
504 a |
505 a |
506 a |
507 taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
508 ts1 |
509 ==========================
510 2025-03-04 00:00:00.000 |
511 2025-03-04 00:00:00.000 |
512 2025-03-04 00:00:00.000 |
513 2025-03-04 00:00:00.000 |
514 taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
515 ts | f | g | ts1 | ts | f | g | 'a' |
516 ============================================================================================================================================
517 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
518 2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
519 2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
520 2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
521 taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
522 ts | f | g |
523 ======================================================
524 2025-03-04 00:00:00.000 | 101 | 1011 |
525 2025-03-04 00:00:01.000 | 102 | 1012 |
526 2025-03-05 00:00:00.000 | 103 | 1013 |
527 2025-03-05 00:00:02.000 | 104 | 1014 |
528 taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
529 ts1 | ts | f | g | 'a' |
530 ======================================================================================
531 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
532 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
533 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
534 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
535 taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
536 c |
537 ======
538 a |
539 a |
540 a |
541 a |
542 taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
543 ts |
544 ==========================
545 2025-03-04 00:00:00.000 |
546 2025-03-04 00:00:01.000 |
547 2025-03-05 00:00:00.000 |
548 2025-03-05 00:00:02.000 |
549 taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
550 ts | f | g | ts1 | ts | f | g | 'a' |
551 ============================================================================================================================================
552 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
553 taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
554 ts | f | g |
555 ======================================================
556 2025-03-04 00:00:00.000 | 101 | 1011 |
557 taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
558 ts1 | ts | f | g | 'a' |
559 ======================================================================================
560 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
561 taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
562 c |
563 ======
564 a |
565 taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
566 ts |
567 ==========================
568 2025-03-04 00:00:00.000 |
569 taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
570 ts | f | g | ts1 | ts | f | g | 'a' |
571 ============================================================================================================================================
572 2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
573 taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
574 ts | f | g |
575 ======================================================
576 2025-03-04 00:00:00.000 | 101 | 1011 |
577 taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
578 ts1 | ts | f | g | 'a' |
579 ======================================================================================
580 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
581 taos> select b.c from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
582 c |
583 ======
584 a |
585 taos> select b.ts from a1 a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
586 ts |
587 ==========================
588 2025-03-04 00:00:00.000 |
589 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
590 ts |
591 ==========================
592 2025-03-04 00:00:00.000 |
593 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
594 ts |
595 ==========================
596 2025-03-04 00:00:00.000 |
597 2025-03-04 00:00:01.000 |
598 2025-03-05 00:00:00.000 |
599 2025-03-05 00:00:02.000 |
600 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
601 ts |
602 ==========================
603 2025-03-04 00:00:00.000 |
604 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
605 ts |
606 ==========================
607 2025-03-04 00:00:00.000 |
608 2025-03-04 00:00:01.000 |
609 2025-03-05 00:00:00.000 |
610 2025-03-05 00:00:02.000 |
611 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
612 ts |
613 ==========================
614 2025-03-04 00:00:00.000 |
615 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
616 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
617 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
618 ts | val | tg2 | ts | val | tg2 |
619 ============================================================================================================
620 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
621 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
622 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
623 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
624 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
625 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
626 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
627 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
628 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val;
629 ts | val | tg2 | ts | val | tg2 |
630 ============================================================================================================
631 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 301 | 1 |
632 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 302 | 1 |
633 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 303 | 1 |
634 2025-03-04 00:00:00.000 | 101 | 1 | 2025-03-04 00:00:00.000 | 304 | 1 |
635 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 401 | 2 |
636 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 402 | 2 |
637 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 403 | 2 |
638 2025-03-04 00:00:00.000 | 201 | 2 | 2025-03-04 00:00:00.000 | 404 | 2 |
639 taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ;
640 taos> select * from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
641 ts | f | g | 'a' | ts | f | g |
642 ==================================================================================================================
643 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
644 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
645 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
646 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
647 taos> select * from (select today as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
648 ts1 | f | g | 'a' | ts | f | g |
649 ==================================================================================================================
650 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
651 2025-03-04 00:00:00.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
652 2025-03-04 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
653 2025-03-04 00:00:00.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
654 taos> select a.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
655 ts | f | g |
656 ======================================================
657 2025-03-04 00:00:00.000 | 101 | 1011 |
658 2025-03-04 00:00:00.000 | 101 | 1011 |
659 2025-03-04 00:00:00.000 | 101 | 1011 |
660 2025-03-04 00:00:00.000 | 101 | 1011 |
661 taos> select b.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
662 ts | f | g | 'a' |
663 ============================================================
664 2025-03-04 00:00:00.000 | 301 | 3011 | a |
665 2025-03-04 00:00:00.000 | 302 | 3012 | a |
666 2025-03-04 00:00:00.000 | 303 | 3013 | a |
667 2025-03-04 00:00:00.000 | 304 | 3014 | a |
668 taos> select b.c from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
669 c |
670 ======
671 a |
672 a |
673 a |
674 a |
675 taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
676 ts |
677 ==========================
678 2025-03-04 00:00:00.000 |
679 2025-03-04 00:00:00.000 |
680 2025-03-04 00:00:00.000 |
681 2025-03-04 00:00:00.000 |
682 taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
683 ts1 |
684 ==========================
685 2025-03-04 00:00:00.000 |
686 2025-03-04 00:00:00.000 |
687 2025-03-04 00:00:00.000 |
688 2025-03-04 00:00:00.000 |
689 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
690 ts1 | ts | f | g | 'a' | ts | f | g |
691 ============================================================================================================================================
692 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
693 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
694 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
695 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
696 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
697 ts | f | g |
698 ======================================================
699 2025-03-04 00:00:00.000 | 101 | 1011 |
700 2025-03-04 00:00:00.000 | 101 | 1011 |
701 2025-03-04 00:00:00.000 | 101 | 1011 |
702 2025-03-04 00:00:00.000 | 101 | 1011 |
703 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
704 ts1 | ts | f | g | 'a' |
705 ======================================================================================
706 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
707 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
708 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
709 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
710 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
711 c |
712 ======
713 a |
714 a |
715 a |
716 a |
717 taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
718 ts1 |
719 ==========================
720 2025-03-04 00:00:00.000 |
721 2025-03-04 00:00:00.000 |
722 2025-03-04 00:00:00.000 |
723 2025-03-04 00:00:00.000 |
724 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
725 ts1 | ts | f | g | 'a' | ts | f | g |
726 ============================================================================================================================================
727 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
728 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
729 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
730 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
731 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
732 ts | f | g |
733 ======================================================
734 2025-03-04 00:00:00.000 | 101 | 1011 |
735 2025-03-04 00:00:01.000 | 102 | 1012 |
736 2025-03-05 00:00:00.000 | 103 | 1013 |
737 2025-03-05 00:00:02.000 | 104 | 1014 |
738 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
739 ts1 | ts | f | g | 'a' |
740 ======================================================================================
741 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
742 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
743 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
744 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
745 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
746 c |
747 ======
748 a |
749 a |
750 a |
751 a |
752 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
753 ts |
754 ==========================
755 2025-03-04 00:00:00.000 |
756 2025-03-04 00:00:01.000 |
757 2025-03-05 00:00:00.000 |
758 2025-03-05 00:00:02.000 |
759 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
760 ts1 | ts | f | g | 'a' | ts | f | g |
761 ============================================================================================================================================
762 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
763 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
764 ts | f | g |
765 ======================================================
766 2025-03-04 00:00:00.000 | 101 | 1011 |
767 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
768 ts1 | ts | f | g | 'a' |
769 ======================================================================================
770 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
771 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
772 c |
773 ======
774 a |
775 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
776 ts |
777 ==========================
778 2025-03-04 00:00:00.000 |
779 taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
780 ts1 | ts | f | g | 'a' | ts | f | g |
781 ============================================================================================================================================
782 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
783 taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
784 ts | f | g |
785 ======================================================
786 2025-03-04 00:00:00.000 | 101 | 1011 |
787 taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
788 ts1 | ts | f | g | 'a' |
789 ======================================================================================
790 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
791 taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
792 c |
793 ======
794 a |
795 taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
796 ts |
797 ==========================
798 2025-03-04 00:00:00.000 |
799 taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
800 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
801 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
802 ts | val | tg2 | ts | val | tg2 |
803 ============================================================================================================
804 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
805 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
806 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
807 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
808 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
809 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
810 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
811 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
812 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today order by tb.val;
813 ts | val | tg2 | ts | val | tg2 |
814 ============================================================================================================
815 2025-03-04 00:00:00.000 | 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
816 2025-03-04 00:00:00.000 | 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
817 2025-03-04 00:00:00.000 | 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
818 2025-03-04 00:00:00.000 | 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
819 2025-03-04 00:00:00.000 | 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
820 2025-03-04 00:00:00.000 | 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
821 2025-03-04 00:00:00.000 | 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
822 2025-03-04 00:00:00.000 | 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
823 taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today ;

View File

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

View File

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

View File

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

View File

@ -24,6 +24,9 @@ class TDTestCase(TBase):
"slowLogScope": "none" "slowLogScope": "none"
} }
today_ts = ""
tomorrow_ts = ""
def insert_data(self): def insert_data(self):
tdLog.printNoPrefix("==========step1:create table") tdLog.printNoPrefix("==========step1:create table")
@ -33,86 +36,130 @@ class TDTestCase(TBase):
tdSql.execute("create table sta(ts timestamp, f int, g int) tags (tg1 int, tg2 int, tg3 int);") tdSql.execute("create table sta(ts timestamp, f int, g int) tags (tg1 int, tg2 int, tg3 int);")
tdSql.execute("create table stb(ts timestamp, f int, g int) tags (tg1 int, tg2 int, tg3 int);") tdSql.execute("create table stb(ts timestamp, f int, g int) tags (tg1 int, tg2 int, tg3 int);")
tdSql.query("select today();") tdSql.query("select today();")
today_ts = tdSql.res[0][0].strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] self.today_ts = tdSql.res[0][0].strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
self.today_date = tdSql.res[0][0].strftime('%Y-%m-%d')
tdSql.query("select today() + 1d;") tdSql.query("select today() + 1d;")
tomorrow_ts = tdSql.res[0][0].strftime('%Y-%m-%d %H:%M:%S.%f')[:-3] self.tomorrow_ts = tdSql.res[0][0].strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
self.tomorrow_date = tdSql.res[0][0].strftime('%Y-%m-%d')
tdLog.printNoPrefix("==========step2:insert data") tdLog.printNoPrefix("==========step2:insert data")
tdSql.execute(f"insert into a1 using sta tags(1, 1, 1) values('{today_ts}', 101, 1011);") tdSql.execute(f"insert into a1 using sta tags(1, 1, 1) values('{self.today_ts}', 101, 1011);")
tdSql.execute(f"insert into a1 using sta tags(1, 1, 1) values('{today_ts}' + 1s, 102, 1012);") tdSql.execute(f"insert into a1 using sta tags(1, 1, 1) values('{self.today_ts}' + 1s, 102, 1012);")
tdSql.execute(f"insert into a1 using sta tags(1, 1, 1) values('{tomorrow_ts}', 103, 1013);") tdSql.execute(f"insert into a1 using sta tags(1, 1, 1) values('{self.tomorrow_ts}', 103, 1013);")
tdSql.execute(f"insert into a1 using sta tags(1, 1, 1) values('{tomorrow_ts}' + 2s, 104, 1014);") tdSql.execute(f"insert into a1 using sta tags(1, 1, 1) values('{self.tomorrow_ts}' + 2s, 104, 1014);")
tdSql.execute(f"insert into a2 using sta tags(1, 2, 2) values('{today_ts}', 201, 2011);") tdSql.execute(f"insert into a2 using sta tags(1, 2, 2) values('{self.today_ts}', 201, 2011);")
tdSql.execute(f"insert into a2 using sta tags(1, 2, 2) values('{today_ts}' + 1s, 202, 2012);") tdSql.execute(f"insert into a2 using sta tags(1, 2, 2) values('{self.today_ts}' + 1s, 202, 2012);")
tdSql.execute(f"insert into a2 using sta tags(1, 2, 2) values('{tomorrow_ts}', 203, 2013);") tdSql.execute(f"insert into a2 using sta tags(1, 2, 2) values('{self.tomorrow_ts}', 203, 2013);")
tdSql.execute(f"insert into a2 using sta tags(1, 2, 2) values('{tomorrow_ts}' + 3s, 204, 2014);") tdSql.execute(f"insert into a2 using sta tags(1, 2, 2) values('{self.tomorrow_ts}' + 3s, 204, 2014);")
tdSql.execute(f"insert into b1 using stb tags(1, 1, 3) values('{today_ts}', 301, 3011);") tdSql.execute(f"insert into b1 using stb tags(1, 1, 3) values('{self.today_ts}', 301, 3011);")
tdSql.execute(f"insert into b1 using stb tags(1, 1, 3) values('{today_ts}' + 1s, 302, 3012);") tdSql.execute(f"insert into b1 using stb tags(1, 1, 3) values('{self.today_ts}' + 1s, 302, 3012);")
tdSql.execute(f"insert into b1 using stb tags(1, 1, 3) values('{tomorrow_ts}', 303, 3013);") tdSql.execute(f"insert into b1 using stb tags(1, 1, 3) values('{self.tomorrow_ts}', 303, 3013);")
tdSql.execute(f"insert into b1 using stb tags(1, 1, 3) values('{tomorrow_ts}' + 2s, 304, 3014);") tdSql.execute(f"insert into b1 using stb tags(1, 1, 3) values('{self.tomorrow_ts}' + 2s, 304, 3014);")
tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{today_ts}', 401, 4011);") tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.today_ts}', 401, 4011);")
tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{today_ts}' + 1s, 402, 4012);") tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.today_ts}' + 1s, 402, 4012);")
tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{tomorrow_ts}', 403, 4013);") tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.tomorrow_ts}', 403, 4013);")
tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{tomorrow_ts}' + 3s, 404, 4014);") tdSql.execute(f"insert into b2 using stb tags(1, 2, 4) values('{self.tomorrow_ts}' + 3s, 404, 4014);")
def replace_string(self, input_file, output_file, old_str, new_str): def replace_string(self, input_file, output_file, old_str, new_str):
print("当前工作目录:", os.getcwd())
script_dir = os.path.dirname(os.path.abspath(__file__)) script_dir = os.path.dirname(os.path.abspath(__file__))
with open(f"{script_dir}/joinConst/{input_file}", 'r') as f_in, open(f"{script_dir}/joinConst/{output_file}", 'w') as f_out: with open(f"{script_dir}/joinConst/{input_file}", 'r') as f_in, open(f"{script_dir}/joinConst/{output_file}", 'w') as f_out:
for line in f_in: for line in f_in:
modified_line = line.replace(old_str, new_str) modified_line = line.replace(old_str, new_str)
f_out.write(modified_line) f_out.write(modified_line)
def test_normal_case(self, testCase): def replace_string2(self, input_file, output_file, old_str, new_str):
self.replace_string(f'{testCase}.in', f'{testCase}.in.today_', '__today__', 'today()') script_dir = os.path.dirname(os.path.abspath(__file__))
with open(f"{script_dir}/joinConst/{input_file}", 'r') as f_in, open(f"{script_dir}/joinConst/{output_file}", 'w', newline="\r\n") as f_out:
for line in f_in:
modified_line = line.replace(old_str, new_str)
f_out.write(modified_line)
def test_today_case(self, testCase):
tdLog.printNoPrefix(f"==========step:{testCase} + today() test")
self.replace_string(f'{testCase}.today.in', f'{testCase}.today_.in.tmp1', '__today__', 'today()')
self.replace_string(f'{testCase}.today_.csv', f'{testCase}.today_.csv.tmp1', '__today__', f'{self.today_date}')
self.replace_string2(f'{testCase}.today_.csv.tmp1', f'{testCase}.today_.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}.in.today_") self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.today_.in.tmp1")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today_.csv") self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today_.csv.tmp2")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
self.replace_string(f'{testCase}.in', f'{testCase}.in.today', '__today__', 'today') tdLog.printNoPrefix(f"==========step:{testCase} + today test")
self.replace_string(f'{testCase}.today.in', f'{testCase}.today.in.tmp1', '__today__', 'today')
self.replace_string(f'{testCase}.today.csv', f'{testCase}.today.csv.tmp1', '__today__', f'{self.today_date}')
self.replace_string2(f'{testCase}.today.csv.tmp1', f'{testCase}.today.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}.in.today") self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.today.in.tmp1")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today.csv") self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today.csv.tmp2")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
# self.replace_string(f'{testCase}.in', f'{testCase}.in.now_', '__today__', 'now()') def test_now_case(self, testCase):
# # read sql from .sql file and execute tdLog.printNoPrefix(f"==========step:{testCase} + now() test")
# self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.now_") self.replace_string(f'{testCase}.now.in', f'{testCase}.now_.in.tmp1', '__const__', 'now()')
# self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.now_.csv") self.replace_string(f'{testCase}.now_.csv', f'{testCase}.now_.csv.tmp1', '__today__', f'{self.today_date}')
# tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) self.replace_string2(f'{testCase}.now_.csv.tmp1', f'{testCase}.now_.csv.tmp2', '__tomorrow__', f'{self.tomorrow_date}')
# # read sql from .sql file and execute
# self.replace_string(f'{testCase}.in', f'{testCase}.in.now', '__today__', 'now') self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.now_.in.tmp1")
# # read sql from .sql file and execute self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.now_.csv.tmp2")
# self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.now") tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
# self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.now.csv")
# tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) tdLog.printNoPrefix(f"==========step:{testCase} + now test")
# self.replace_string(f'{testCase}.now.in', f'{testCase}.now.in.tmp1', '__const__', 'now')
# self.replace_string(f'{testCase}.in', f'{testCase}.in.today_ts', '__today__', f'{today_ts}') self.replace_string(f'{testCase}.now.csv', f'{testCase}.now.csv.tmp1', '__today__', f'{self.today_date}')
# # read sql from .sql file and execute self.replace_string2(f'{testCase}.now.csv.tmp1', f'{testCase}.now.csv.tmp2', '__tomorrow__', f'{self.tomorrow_date}')
# self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.today_ts") # read sql from .sql file and execute
# self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today_ts.csv") self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.now.in.tmp1")
# tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.now.csv.tmp2")
# tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
# self.replace_string(f'{testCase}.in', f'{testCase}.in.tomorrow_ts', '__today__', f'{tomorrow_ts}')
# # read sql from .sql file and execute def test_constts_case(self, testCase):
# self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.tomorrow_ts") tdLog.printNoPrefix(f"==========step:{testCase} + ts:{self.today_ts} test")
# self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.tomorrow_ts.csv") self.replace_string(f'{testCase}.constts.in', f'{testCase}.constts.in.tmp1', '__today__', f'"{self.today_ts}"')
# tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase) # read sql from .sql file and execute
self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.constts.in.tmp1")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today_ts.csv")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
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}"')
# read sql from .sql file and execute
self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.constts.in.tmp2")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.tomorrow_ts.csv")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
def test_nocheck_case(self):
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;")
#select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
#select * from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
#select b.* from a1 a join (select __const__ as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
#select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
#select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
#select * from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
#select b.* from a1 a , (select __const__ as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
#select * from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
#select b.* from (select __const__ as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
def test_abnormal_case(self): def test_abnormal_case(self):
tdLog.info("test abnormal case.") 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("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);")
def run(self): def run(self):
tdLog.debug(f"start to excute {__file__}") tdLog.debug(f"start to excute {__file__}")
self.insert_data() self.insert_data()
self.test_normal_case("inner")
self.test_abnormal_case() self.test_today_case("inner")
self.test_now_case("inner")
#self.test_constts_case("inner")
self.test_today_case("left_outer")
#self.test_abnormal_case()
tdLog.success(f"{__file__} successfully executed") tdLog.success(f"{__file__} successfully executed")