fix: constant join issues
This commit is contained in:
parent
5204f97a4b
commit
364381c6f1
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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 ;
|
||||||
|
|
|
|
@ -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__ ;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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() ;
|
||||||
|
|
|
File diff suppressed because it is too large
Load Diff
|
@ -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
|
@ -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.
|
|
@ -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 ;
|
||||||
|
|
|
|
@ -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;
|
||||||
|
|
|
|
@ -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__;
|
||||||
|
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
|
@ -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")
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue