fix: add test cases

This commit is contained in:
dapan1121 2025-03-03 19:31:43 +08:00
parent e41cd44c51
commit 5204f97a4b
13 changed files with 2408 additions and 26 deletions

View File

@ -158,7 +158,10 @@ typedef struct SJoinLogicNode {
// FOR CONST JOIN
bool noPrimKeyEqCond;
bool constPrimGot;
bool leftConstPrimGot;
bool rightConstPrimGot;
bool leftNoOrderedSubQuery;
bool rightNoOrderedSubQuery;
// FOR HASH JOIN
int32_t timeRangeTarget; // table onCond filter

View File

@ -57,11 +57,13 @@ typedef struct SExprNode {
SDataType resType;
char aliasName[TSDB_COL_NAME_LEN];
char userAlias[TSDB_COL_NAME_LEN];
char srcTable[TSDB_TABLE_NAME_LEN];
SArray* pAssociation;
bool asAlias;
bool asParam;
bool asPosition;
bool joinSrc;
// bool joinConst;
int32_t projIdx;
int32_t relatedTo;
int32_t bindExprID;
@ -293,6 +295,10 @@ typedef struct SJoinTableNode {
SNode* addPrimCond;
bool hasSubQuery;
bool isLowLevelJoin;
bool leftNoOrderedSubQuery;
bool rightNoOrderedSubQuery;
//bool condAlwaysTrue;
//bool condAlwaysFalse;
SNode* pLeft;
SNode* pRight;
SNode* pOnCond;

View File

@ -102,6 +102,7 @@ static int32_t exprNodeCopy(const SExprNode* pSrc, SExprNode* pDst) {
COPY_OBJECT_FIELD(resType, sizeof(SDataType));
COPY_CHAR_ARRAY_FIELD(aliasName);
COPY_CHAR_ARRAY_FIELD(userAlias);
COPY_CHAR_ARRAY_FIELD(srcTable);
COPY_SCALAR_FIELD(asAlias);
COPY_SCALAR_FIELD(asParam);
COPY_SCALAR_FIELD(asPosition);
@ -323,6 +324,10 @@ static int32_t joinTableNodeCopy(const SJoinTableNode* pSrc, SJoinTableNode* pDs
CLONE_NODE_FIELD(addPrimCond);
COPY_SCALAR_FIELD(hasSubQuery);
COPY_SCALAR_FIELD(isLowLevelJoin);
COPY_SCALAR_FIELD(leftNoOrderedSubQuery);
COPY_SCALAR_FIELD(rightNoOrderedSubQuery);
//COPY_SCALAR_FIELD(condAlwaysTrue);
//COPY_SCALAR_FIELD(condAlwaysFalse);
CLONE_NODE_FIELD(pLeft);
CLONE_NODE_FIELD(pRight);
CLONE_NODE_FIELD(pOnCond);
@ -545,7 +550,10 @@ static int32_t logicJoinCopy(const SJoinLogicNode* pSrc, SJoinLogicNode* pDst) {
COPY_SCALAR_FIELD(hashJoinHint);
COPY_SCALAR_FIELD(batchScanHint);
COPY_SCALAR_FIELD(noPrimKeyEqCond);
COPY_SCALAR_FIELD(constPrimGot);
COPY_SCALAR_FIELD(leftConstPrimGot);
COPY_SCALAR_FIELD(rightConstPrimGot);
COPY_SCALAR_FIELD(leftNoOrderedSubQuery);
COPY_SCALAR_FIELD(rightNoOrderedSubQuery);
CLONE_NODE_FIELD(pLeftOnCond);
CLONE_NODE_FIELD(pRightOnCond);
COPY_SCALAR_FIELD(timeRangeTarget);

View File

@ -127,13 +127,33 @@ static int32_t rewriteConditionForFromTable(SCalcConstContext* pCxt, SNode* pTab
}
case QUERY_NODE_JOIN_TABLE: {
SJoinTableNode* pJoin = (SJoinTableNode*)pTable;
SNode* pCond = NULL;
code = rewriteConditionForFromTable(pCxt, pJoin->pLeft);
if (TSDB_CODE_SUCCESS == code) {
code = rewriteConditionForFromTable(pCxt, pJoin->pRight);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pOnCond) {
code = nodesCloneNode(pJoin->pOnCond, &pCond);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pOnCond) {
code = calcConstCondition(pCxt, &pJoin->pOnCond);
}
if (TSDB_CODE_SUCCESS == code && pJoin->pOnCond && QUERY_NODE_VALUE == nodeType(pJoin->pOnCond)) {
nodesDestroyNode(pJoin->pOnCond);
pJoin->pOnCond = pCond;
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);
// todo empty table
break;
}
@ -215,7 +235,7 @@ static int32_t calcConstProject(SCalcConstContext* pCxt, SNode* pProject, bool d
}
}
char aliasName[TSDB_COL_NAME_LEN] = {0};
char aliasName[TSDB_COL_NAME_LEN] = {0}, srcTable[TSDB_TABLE_NAME_LEN] = {0};
int32_t code = TSDB_CODE_SUCCESS;
if (dual) {
code = scalarCalculateConstantsFromDual(pProject, pNew);
@ -229,11 +249,15 @@ static int32_t calcConstProject(SCalcConstContext* pCxt, SNode* pProject, bool d
SAssociationNode* pAssNode = taosArrayGet(pAssociation, i);
SNode** pCol = pAssNode->pPlace;
if (((SExprNode*)pAssNode->pAssociationNode)->joinSrc) {
// ((SExprNode*)pAssNode->pAssociationNode)->joinConst = true;
continue;
}
if (*pCol == pAssNode->pAssociationNode) {
tstrncpy(aliasName, ((SExprNode*)*pCol)->aliasName, TSDB_COL_NAME_LEN);
if (QUERY_NODE_COLUMN == nodeType(*pCol)) {
tstrncpy(srcTable, ((SColumnNode*)*pCol)->tableAlias, TSDB_TABLE_NAME_LEN);
}
SArray* pOrigAss = NULL;
TSWAP(((SExprNode*)*pCol)->pAssociation, pOrigAss);
nodesDestroyNode(*pCol);
@ -241,6 +265,9 @@ static int32_t calcConstProject(SCalcConstContext* pCxt, SNode* pProject, bool d
code = nodesCloneNode(*pNew, pCol);
if (TSDB_CODE_SUCCESS == code) {
tstrncpy(((SExprNode*)*pCol)->aliasName, aliasName, TSDB_COL_NAME_LEN);
if (srcTable[0]) {
tstrncpy(((SExprNode*)*pCol)->srcTable, srcTable, TSDB_TABLE_NAME_LEN);
}
TSWAP(pOrigAss, ((SExprNode*)*pCol)->pAssociation);
}
taosArrayDestroy(pOrigAss);

View File

@ -4760,6 +4760,7 @@ static int32_t checkJoinTable(STranslateContext* pCxt, SJoinTableNode* pJoinTabl
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SUPPORT_JOIN,
"Join requires valid time series input");
}
pJoinTable->leftNoOrderedSubQuery = true;
}
if (QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pRight) &&
@ -4768,6 +4769,7 @@ static int32_t checkJoinTable(STranslateContext* pCxt, SJoinTableNode* pJoinTabl
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SUPPORT_JOIN,
"Join requires valid time series input");
}
pJoinTable->rightNoOrderedSubQuery = true;
}
@ -5098,6 +5100,49 @@ static int32_t setJoinTimeLineResMode(STranslateContext* pCxt) {
return TSDB_CODE_SUCCESS;
}
int32_t mergeInnerJoinConds(SNode** ppDst, SNode** ppSrc) {
SNode* pNew = NULL;
int32_t code = TSDB_CODE_SUCCESS;
while (true) {
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppDst) && ((SLogicConditionNode*)*ppDst)->condType == LOGIC_COND_TYPE_AND) {
SLogicConditionNode* pLogic = (SLogicConditionNode*)*ppDst;
code = nodesListMakeStrictAppend(&pLogic->pParameterList, *ppSrc);
if (TSDB_CODE_SUCCESS == code) {
*ppSrc = NULL;
}
return code;
}
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc) && ((SLogicConditionNode*)*ppSrc)->condType == LOGIC_COND_TYPE_AND) {
SNode* pTmp = *ppDst;
*ppDst = *ppSrc;
*ppSrc = pTmp;
continue;
}
code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, &pNew);
if (TSDB_CODE_SUCCESS == code) {
SLogicConditionNode* pLogic = (SLogicConditionNode*)pNew;
pLogic->condType = LOGIC_COND_TYPE_AND;
pLogic->node.resType.type = TSDB_DATA_TYPE_BOOL;
pLogic->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
code = nodesListMakeStrictAppend(&pLogic->pParameterList, *ppSrc);
if (TSDB_CODE_SUCCESS == code) {
*ppSrc = *ppDst;
*ppDst = pNew;
continue;
}
}
if (code) {
break;
}
}
return code;
}
int32_t translateTable(STranslateContext* pCxt, SNode** pTable, bool inJoin) {
SSelectStmt* pCurrSmt = (SSelectStmt*)(pCxt->pCurrStmt);
int32_t code = TSDB_CODE_SUCCESS;
@ -5184,6 +5229,14 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, bool inJoin) {
if (TSDB_CODE_SUCCESS == code) {
code = checkJoinTable(pCxt, pJoinTable);
}
if (TSDB_CODE_SUCCESS == code && pCurrSmt->pWhere && JOIN_TYPE_INNER == pJoinTable->joinType) {
if (pJoinTable->pOnCond) {
code = mergeInnerJoinConds(&pJoinTable->pOnCond, &pCurrSmt->pWhere);
} else {
pJoinTable->pOnCond = pCurrSmt->pWhere;
pCurrSmt->pWhere = NULL;
}
}
if (TSDB_CODE_SUCCESS == code) {
pJoinTable->table.precision = calcJoinTablePrecision(pJoinTable);
pJoinTable->table.singleTable = joinTableIsSingleTable(pJoinTable);

View File

@ -600,6 +600,8 @@ static int32_t createJoinLogicNode(SLogicPlanContext* pCxt, SSelectStmt* pSelect
pJoin->node.requireDataOrder = pJoin->hashJoinHint ? DATA_ORDER_LEVEL_NONE : DATA_ORDER_LEVEL_GLOBAL;
pJoin->node.resultDataOrder = DATA_ORDER_LEVEL_NONE;
pJoin->isLowLevelJoin = pJoinTable->isLowLevelJoin;
pJoin->leftNoOrderedSubQuery = pJoinTable->leftNoOrderedSubQuery;
pJoin->rightNoOrderedSubQuery = pJoinTable->leftNoOrderedSubQuery;
code = nodesCloneNode(pJoinTable->pWindowOffset, &pJoin->pWindowOffset);
if (TSDB_CODE_SUCCESS == code) {

View File

@ -630,8 +630,16 @@ static bool pdcJoinColInTableColList(SNode* pNode, SNodeList* pTableCols) {
}
static bool pdcJoinColInTableList(SNode* pCondCol, SSHashObj* pTables) {
SColumnNode* pTableCol = (SColumnNode*)pCondCol;
if (NULL == tSimpleHashGet(pTables, pTableCol->tableAlias, strlen(pTableCol->tableAlias))) {
char* pTableAlias = NULL;
if (QUERY_NODE_COLUMN == nodeType(pCondCol)) {
SColumnNode* pTableCol = (SColumnNode*)pCondCol;
pTableAlias = pTableCol->tableAlias;
} else if (QUERY_NODE_VALUE == nodeType(pCondCol)) {
SValueNode* pVal = (SValueNode*)pCondCol;
pTableAlias = pVal->node.srcTable;
}
if (NULL == tSimpleHashGet(pTables, pTableAlias, strlen(pTableAlias))) {
return false;
}
return true;
@ -835,8 +843,10 @@ static bool pdcJoinIsPrim(SNode* pNode, SSHashObj* pTables, bool constAsPrim, bo
if (QUERY_NODE_VALUE == nodeType(pNode)) {
SValueNode* pVal = (SValueNode*)pNode;
if (TSDB_DATA_TYPE_NULL != pVal->node.resType.type && !pVal->isNull) {
*constPrimGot = true;
return true;
if (pdcJoinColInTableList(pNode, pTables)) {
*constPrimGot = true;
return true;
}
}
return false;
@ -890,15 +900,11 @@ static bool pdcJoinIsPrimEqualCond(SJoinLogicNode* pJoin, SNode* pCond, bool con
}
bool res = false, constGot = false;
if (pdcJoinIsPrim(pOper->pLeft, pLeftTables, constAsPrim, &constGot)) {
res = pdcJoinIsPrim(pOper->pRight, pRightTables, constAsPrim, &constGot);
if (constGot) {
pJoin->constPrimGot = true;
}
} else if (pdcJoinIsPrim(pOper->pLeft, pRightTables, constAsPrim, &constGot)) {
res = pdcJoinIsPrim(pOper->pRight, pLeftTables, constAsPrim, &constGot);
if (constGot) {
pJoin->constPrimGot = true;
if (pdcJoinIsPrim(pOper->pLeft, pLeftTables, constAsPrim, &pJoin->leftConstPrimGot)) {
res = pdcJoinIsPrim(pOper->pRight, pRightTables, constAsPrim, &pJoin->rightConstPrimGot);
} else if (pdcJoinIsPrim(pOper->pLeft, pRightTables, constAsPrim, &pJoin->rightConstPrimGot)) {
res = pdcJoinIsPrim(pOper->pRight, pLeftTables, constAsPrim, &pJoin->leftConstPrimGot);
if (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot) {
TSWAP(pOper->pLeft, pOper->pRight);
}
}
@ -940,12 +946,14 @@ static int32_t pdcJoinSplitPrimInLogicCond(SJoinLogicNode* pJoin, SNode** ppInpu
SNode* pCond = NULL;
WHERE_EACH(pCond, pLogicCond->pParameterList) {
SNode* pNew = NULL;
code = nodesCloneNode(pCond, &pNew);
if (TSDB_CODE_SUCCESS != code) break;
if (pdcJoinIsPrimEqualCond(pJoin, pCond, constAsPrim) && (NULL == *ppPrimEqCond)) {
code = nodesCloneNode(pCond, &pNew);
if (TSDB_CODE_SUCCESS != code) break;
*ppPrimEqCond = pNew;
ERASE_NODE(pLogicCond->pParameterList);
} else {
code = nodesCloneNode(pCond, &pNew);
if (TSDB_CODE_SUCCESS != code) break;
code = nodesListMakeAppend(&pOnConds, pNew);
if (TSDB_CODE_SUCCESS != code) break;
WHERE_NEXT;
@ -1448,7 +1456,7 @@ static int32_t pdcJoinSplitConstPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNod
if (TSDB_CODE_SUCCESS == code) {
pJoin->pPrimKeyEqCond = pPrimKeyEqCond;
*ppCond = pJoinOnCond;
if (pJoin->constPrimGot) {
if (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot) {
code = scalarConvertOpValueNodeTs((SOperatorNode*)pJoin->pPrimKeyEqCond);
}
} else {
@ -1478,7 +1486,8 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin
SNode** ppCond = pJoin->pFullOnCond ? &pJoin->pFullOnCond : &pJoin->node.pConditions;
bool errCond = false;
if (!pdcJoinHasPrimEqualCond(pJoin, *ppCond, &errCond)) {
bool primCondGot = pdcJoinHasPrimEqualCond(pJoin, *ppCond, &errCond);
if (!primCondGot) {
if (errCond && !(IS_INNER_NONE_JOIN(pJoin->joinType, pJoin->subType) && NULL != pJoin->pFullOnCond &&
NULL != pJoin->node.pConditions)) {
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_NOT_SUPPORT_JOIN_COND);
@ -1486,7 +1495,8 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin
if (IS_INNER_NONE_JOIN(pJoin->joinType, pJoin->subType) && NULL != pJoin->pFullOnCond &&
NULL != pJoin->node.pConditions) {
if (pdcJoinHasPrimEqualCond(pJoin, pJoin->node.pConditions, &errCond)) {
primCondGot = pdcJoinHasPrimEqualCond(pJoin, pJoin->node.pConditions, &errCond);
if (primCondGot) {
return TSDB_CODE_SUCCESS;
}
if (errCond) {
@ -1497,7 +1507,9 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin
if (IS_WINDOW_JOIN(pJoin->subType) || IS_ASOF_JOIN(pJoin->subType)) {
return TSDB_CODE_SUCCESS;
}
}
if (pJoin->leftNoOrderedSubQuery || pJoin->rightNoOrderedSubQuery || !primCondGot) {
pJoin->noPrimKeyEqCond = true;
int32_t code = pdcJoinSplitConstPrimEqCond(pCxt, pJoin, ppCond);
if (code || pJoin->pPrimKeyEqCond) {
@ -1515,6 +1527,10 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL);
}
//if ((pJoin->leftNoOrderedSubQuery || pJoin->rightNoOrderedSubQuery) && !primCondGot) {
// return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PAR_VALID_TS_SERIOUS_REQUIRED);
//}
if (IS_ASOF_JOIN(pJoin->subType)) {
nodesDestroyNode(pJoin->addPrimEqCond);
pJoin->addPrimEqCond = NULL;
@ -2680,7 +2696,7 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL
bool res = false;
SOperatorNode* pOp = (SOperatorNode*)pJoin->pPrimKeyEqCond;
if (QUERY_NODE_VALUE != nodeType(pOp->pLeft) || QUERY_NODE_VALUE != nodeType(pOp->pRight)) {
if (QUERY_NODE_VALUE == nodeType(pOp->pLeft) || QUERY_NODE_VALUE == nodeType(pOp->pRight)) {
return TSDB_CODE_SUCCESS;
}

View File

@ -375,7 +375,7 @@ static EDealRes doSetSlotId(SNode* pNode, void* pContext) {
SSetSlotIdCxt* pCxt = (SSetSlotIdCxt*)pContext;
char* name = NULL;
int32_t len = 0;
pCxt->errCode = getSlotKey(pNode, NULL, &name, &len, 16);
pCxt->errCode = getSlotKey(pNode, NULL, &name, &len, 64);
if (TSDB_CODE_SUCCESS != pCxt->errCode) {
return DEAL_RES_ERROR;
}
@ -386,7 +386,10 @@ static EDealRes doSetSlotId(SNode* pNode, void* pContext) {
if (!pIndex) {
pIndex = taosHashGet(pCxt->pRightProdIdxHash, name, strlen(name));
}
} else {
}
if (NULL == pIndex) {
name[len] = 0;
pIndex = taosHashGet(pCxt->pLeftHash, name, len);
if (NULL == pIndex) {
pIndex = taosHashGet(pCxt->pRightHash, name, len);
@ -948,7 +951,7 @@ static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_
break;
}
case QUERY_NODE_VALUE: {
if (pJoinLogicNode && pJoinLogicNode->constPrimGot) {
if (pJoinLogicNode && pJoinLogicNode->leftConstPrimGot) {
pJoin->leftPrimExpr = NULL;
code = nodesCloneNode(pOp->pLeft, &pJoin->leftPrimExpr);
break;
@ -1006,7 +1009,7 @@ static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_
break;
}
case QUERY_NODE_VALUE: {
if (pJoinLogicNode && pJoinLogicNode->constPrimGot) {
if (pJoinLogicNode && pJoinLogicNode->rightConstPrimGot) {
pJoin->rightPrimExpr = NULL;
code = nodesCloneNode(pOp->pRight, &pJoin->rightPrimExpr);
break;
@ -1054,6 +1057,33 @@ static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_
return code;
}
static int32_t removePrimColFromJoinTargets(SNodeList* pTargets, SValueNode* pLeftPrimExpr, SColumnNode** ppRemoved) {
int32_t code = TSDB_CODE_SUCCESS;
SNode* pNode = NULL;
FOREACH(pNode, pTargets) {
SColumnNode* pCol = (SColumnNode*)pNode;
if (0 == strcmp(pCol->tableAlias, pLeftPrimExpr->node.srcTable) && 0 == strcmp(pCol->colName, pLeftPrimExpr->node.aliasName)) {
code = nodesCloneNode(pNode, (SNode**)ppRemoved);
ERASE_NODE(pTargets);
break;
}
}
return code;
}
static int32_t appendPrimColToJoinTargets(SSortMergeJoinPhysiNode* pJoin, SColumnNode** ppTarget, STargetNode* primExpr, int16_t blkId) {
SColumnNode* pCol = *ppTarget;
pCol->dataBlockId = blkId;
pCol->slotId = primExpr->slotId;
int32_t code = nodesListMakeStrictAppend(&pJoin->pTargets, (SNode *)pCol);
if (TSDB_CODE_SUCCESS == code) {
*ppTarget = NULL;
}
return code;
}
static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChildren, SJoinLogicNode* pJoinLogicNode,
SPhysiNode** pPhyNode) {
SSortMergeJoinPhysiNode* pJoin =
@ -1115,11 +1145,32 @@ static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
nodesDestroyNode(pPrimKeyCond);
}
SValueNode* pLeftPrimExpr = NULL, *pRightPrimExpr = NULL;
SColumnNode* pLeftTarget = NULL, *pRightTarget = NULL;
if (TSDB_CODE_SUCCESS == code && pJoinLogicNode->leftConstPrimGot && pJoin->leftPrimExpr
&& QUERY_NODE_VALUE == nodeType(((STargetNode*)pJoin->leftPrimExpr)->pExpr)) {
pLeftPrimExpr = (SValueNode*)((STargetNode*)pJoin->leftPrimExpr)->pExpr;
code = removePrimColFromJoinTargets(pJoinLogicNode->node.pTargets, pLeftPrimExpr, &pLeftTarget);
}
if (TSDB_CODE_SUCCESS == code && pJoinLogicNode->rightConstPrimGot && pJoin->rightPrimExpr
&& QUERY_NODE_VALUE == nodeType(((STargetNode*)pJoin->rightPrimExpr)->pExpr)) {
pRightPrimExpr = (SValueNode*)((STargetNode*)pJoin->rightPrimExpr)->pExpr;
code = removePrimColFromJoinTargets(pJoinLogicNode->node.pTargets, pRightPrimExpr, &pRightTarget);
}
if (TSDB_CODE_SUCCESS == code) {
code = setListSlotId(pCxt, pLeftDesc->dataBlockId, pRightDesc->dataBlockId, pJoinLogicNode->node.pTargets,
&pJoin->pTargets);
}
if (TSDB_CODE_SUCCESS == code && pLeftPrimExpr && pLeftTarget) {
code = appendPrimColToJoinTargets(pJoin, &pLeftTarget, (STargetNode*)pJoin->leftPrimExpr, pLeftDesc->dataBlockId);
}
if (TSDB_CODE_SUCCESS == code && pRightPrimExpr && pRightTarget) {
code = appendPrimColToJoinTargets(pJoin, &pRightTarget, (STargetNode*)pJoin->rightPrimExpr, pRightDesc->dataBlockId);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoinLogicNode->pFullOnCond) {
code = setNodeSlotId(pCxt, ((SPhysiNode*)pJoin)->pOutputDataBlockDesc->dataBlockId, -1, pJoinLogicNode->pFullOnCond,
&pJoin->pFullOnCond);
@ -1171,6 +1222,8 @@ static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
*pPhyNode = (SPhysiNode*)pJoin;
} else {
nodesDestroyNode((SNode*)pJoin);
nodesDestroyNode((SNode*)pLeftTarget);
nodesDestroyNode((SNode*)pRightTarget);
}
return code;

View File

@ -26,6 +26,8 @@ static char* getUsageErrFormat(int32_t errCode) {
return "not support cross join";
case TSDB_CODE_PLAN_NOT_SUPPORT_JOIN_COND:
return "Not supported join conditions";
case TSDB_CODE_PAR_VALID_TS_SERIOUS_REQUIRED:
return "Valid time series required as input";
default:
break;
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,121 @@
###################################################################
# Copyright (c) 2016 by TAOS Technologies, Inc.
# All rights reserved.
#
# This file is proprietary and confidential to TAOS Technologies.
# No part of this file may be reproduced, stored, transmitted,
# disclosed or used in any form or by any means other than as
# expressly provided by the written permission from Jianhui Tao
#
###################################################################
# -*- coding: utf-8 -*-
from frame import etool
from frame.etool import *
from frame.log import *
from frame.cases import *
from frame.sql import *
from frame.caseBase import *
from frame.common import *
class TDTestCase(TBase):
updatecfgDict = {
"slowLogScope": "none"
}
def insert_data(self):
tdLog.printNoPrefix("==========step1:create table")
tdSql.execute("drop database if exists test")
tdSql.execute("create database test keep 36500")
tdSql.execute("use test")
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.query("select today();")
today_ts = tdSql.res[0][0].strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
tdSql.query("select today() + 1d;")
tomorrow_ts = tdSql.res[0][0].strftime('%Y-%m-%d %H:%M:%S.%f')[:-3]
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('{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('{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('{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('{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('{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('{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('{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('{tomorrow_ts}' + 3s, 404, 4014);")
def replace_string(self, input_file, output_file, old_str, new_str):
print("当前工作目录:", os.getcwd())
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:
for line in f_in:
modified_line = line.replace(old_str, new_str)
f_out.write(modified_line)
def test_normal_case(self, testCase):
self.replace_string(f'{testCase}.in', f'{testCase}.in.today_', '__today__', 'today()')
# read sql from .sql file and execute
self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.today_")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today_.csv")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
self.replace_string(f'{testCase}.in', f'{testCase}.in.today', '__today__', 'today')
# read sql from .sql file and execute
self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.today")
self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today.csv")
tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
# self.replace_string(f'{testCase}.in', f'{testCase}.in.now_', '__today__', 'now()')
# # read sql from .sql file and execute
# self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.now_")
# self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.now_.csv")
# tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
#
# self.replace_string(f'{testCase}.in', f'{testCase}.in.now', '__today__', 'now')
# # read sql from .sql file and execute
# self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.now")
# self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.now.csv")
# tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
#
# self.replace_string(f'{testCase}.in', f'{testCase}.in.today_ts', '__today__', f'{today_ts}')
# # read sql from .sql file and execute
# self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.today_ts")
# self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.today_ts.csv")
# 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
# self.sqlFile = etool.curFile(__file__, f"joinConst/{testCase}.in.tomorrow_ts")
# self.ansFile = etool.curFile(__file__, f"joinConst/{testCase}.tomorrow_ts.csv")
# tdCom.compare_testcase_result(self.sqlFile, self.ansFile, testCase)
def test_abnormal_case(self):
tdLog.info("test abnormal case.")
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):
tdLog.debug(f"start to excute {__file__}")
self.insert_data()
self.test_normal_case("inner")
self.test_abnormal_case()
tdLog.success(f"{__file__} successfully executed")
tdCases.addLinux(__file__, TDTestCase())
tdCases.addWindows(__file__, TDTestCase())