Merge pull request #30136 from taosdata/feat/TS-5992

feat: support constant as join primary key
This commit is contained in:
Simon Guan 2025-03-14 10:47:50 +08:00 committed by GitHub
commit c4af33740e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
49 changed files with 15844 additions and 162 deletions

View File

@ -462,8 +462,8 @@ This document details the server error codes that may be encountered when using
| 0x80002688 | Cannot use 'year' or 'month' as true_for duration | Use year or month as true_for_duration | Check and correct the SQL statement |
| 0x80002689 | Invalid using cols function | Illegal using cols function | Check and correct the SQL statement |
| 0x8000268A | Cols function's first param must be a select function that output a single row | The first parameter of the cols function should be a selection function | Check and correct the SQL statement |
| 0x8000268B | Invalid using cols function with multiple output columns | Illegal using the cols function for multiple column output | Check and correct the SQL statement |
| 0x8000268C | Invalid using alias for cols function | Illegal cols function alias | Check and correct the SQL statement |
| 0x8000268B | Invalid using alias for cols function | Illegal cols function alias | Check and correct the SQL statement |
| 0x8000268C | Join primary key col must be timestmap type | Join primary key data type error | Check and correct the SQL statement |
| 0x800026FF | Parser internal error | Internal error in parser | Preserve the scene and logs, report issue on GitHub |
| 0x80002700 | Planner internal error | Internal error in planner | Preserve the scene and logs, report issue on GitHub |
| 0x80002701 | Expect ts equal | JOIN condition validation failed | Preserve the scene and logs, report issue on GitHub |

View File

@ -479,8 +479,8 @@ description: TDengine 服务端的错误码列表和详细说明
| 0x80002688 | Cannot use 'year' or 'month' as true_for duration | 不能使用 n(月), y(年) 作为 true_for 的时间单位 | 检查并修正 SQL 语句 |
| 0x80002689 | Invalid using cols function | cols 函数使用错误 | 检查并修正 SQL 语句 |
| 0x8000268A | Cols function's first param must be a select function that output a single row | cols 函数第一个参数应该为选择函数 | 检查并修正 SQL 语句 |
| 0x8000268B | Invalid using cols function with multiple output columns | 多列输出的 cols 函数使用错误 | 检查并修正 SQL 语句 |
| 0x8000268C | Invalid using alias for cols function | cols 函数输出列重命名错误 | 检查并修正 SQL 语句 |
| 0x8000268B | Invalid using alias for cols function | cols 函数输出列重命名错误 | 检查并修正 SQL 语句 |
| 0x8000268C | Join primary key col must be timestmap type | 关联查询主键列等值条件类型错误 | 检查并修正 SQL 语句 |
| 0x800026FF | Parser internal error | 解析器内部错误 | 保留现场和日志github上报issue |
| 0x80002700 | Planner internal error | 计划期内部错误 | 保留现场和日志github上报issue |
| 0x80002701 | Expect ts equal | JOIN 条件校验失败 | 保留现场和日志github上报issue |

View File

@ -155,6 +155,13 @@ typedef struct SJoinLogicNode {
bool grpJoin;
bool hashJoinHint;
bool batchScanHint;
// FOR CONST JOIN
bool noPrimKeyEqCond;
bool leftConstPrimGot;
bool rightConstPrimGot;
bool leftNoOrderedSubQuery;
bool rightNoOrderedSubQuery;
// FOR HASH JOIN
int32_t timeRangeTarget; // table onCond filter

View File

@ -57,10 +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 constValue;
int32_t projIdx;
int32_t relatedTo;
int32_t bindExprID;
@ -209,6 +212,7 @@ typedef struct STableNode {
char tableAlias[TSDB_TABLE_NAME_LEN];
uint8_t precision;
bool singleTable;
bool inJoin;
} STableNode;
struct STableMeta;
@ -291,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;
@ -706,6 +714,8 @@ int32_t mergeJoinConds(SNode** ppDst, SNode** ppSrc);
void rewriteExprAliasName(SExprNode* pNode, int64_t num);
bool isRelatedToOtherExpr(SExprNode* pExpr);
bool nodesContainsColumn(SNode* pNode);
int32_t nodesMergeNode(SNode** pCond, SNode** pAdditionalCond);
#ifdef __cplusplus
}

View File

@ -33,6 +33,7 @@ pNode will be freed in API;
*/
int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes);
int32_t scalarCalculateConstantsFromDual(SNode *pNode, SNode **pRes);
int32_t scalarConvertOpValueNodeTs(SOperatorNode *node);
/*
pDst need to freed in caller

View File

@ -913,8 +913,8 @@ int32_t taosGetErrSize();
#define TSDB_CODE_PAR_TRUE_FOR_UNIT TAOS_DEF_ERROR_CODE(0, 0x2688)
#define TSDB_CODE_PAR_INVALID_COLS_FUNCTION TAOS_DEF_ERROR_CODE(0, 0x2689)
#define TSDB_CODE_PAR_INVALID_COLS_SELECTFUNC TAOS_DEF_ERROR_CODE(0, 0x268A)
#define TSDB_CODE_INVALID_MULITI_COLS_FUNC TAOS_DEF_ERROR_CODE(0, 0x268B)
#define TSDB_CODE_INVALID_COLS_ALIAS TAOS_DEF_ERROR_CODE(0, 0x268C)
#define TSDB_CODE_PAR_INVALID_COLS_ALIAS TAOS_DEF_ERROR_CODE(0, 0x268B)
#define TSDB_CODE_PAR_PRIM_KEY_MUST_BE_TS TAOS_DEF_ERROR_CODE(0, 0x268C)
#define TSDB_CODE_PAR_INTERNAL_ERROR TAOS_DEF_ERROR_CODE(0, 0x26FF)
//planner

View File

@ -40,6 +40,11 @@ typedef enum EJoinTableType {
E_JOIN_TB_PROBE
} EJoinTableType;
typedef enum EPrimExprType {
E_PRIM_TIMETRUNCATE = 1,
E_PRIM_VALUE
} EPrimExprType;
#define MJOIN_TBTYPE(_type) (E_JOIN_TB_BUILD == (_type) ? "BUILD" : "PROBE")
#define IS_FULL_OUTER_JOIN(_jtype, _stype) ((_jtype) == JOIN_TYPE_FULL && (_stype) == JOIN_STYPE_OUTER)
@ -87,9 +92,15 @@ typedef struct SMJoinNMatchCtx {
// for now timetruncate only
typedef struct SMJoinPrimExprCtx {
int64_t truncateUnit;
int64_t timezoneUnit;
int32_t targetSlotId;
EPrimExprType type;
// FOR TIMETRUNCATE
int64_t truncateUnit;
int64_t timezoneUnit;
int32_t targetSlotId;
// FOR VALUE
int64_t constTs;
} SMJoinPrimExprCtx;
typedef struct SMJoinTableCtx {
@ -337,6 +348,8 @@ typedef struct SMJoinOperatorInfo {
#define PROBE_TS_NREACH(_asc, _pts, _bts) (((_asc) && (_pts) > (_bts)) || (!(_asc) && (_pts) < (_bts)))
#define MJOIN_BUILD_BLK_OOR(_asc, _pts, _pidx, _bts, _bnum) (((_asc) && (*((int64_t*)(_pts) + (_pidx)) > *((int64_t*)(_bts) + (_bnum) - 1))) || ((!(_asc)) && (*((int64_t*)(_pts) + (_pidx)) < *((int64_t*)(_bts) + (_bnum) - 1))))
#define MJOIN_PRIM_EXPR_GOT(_pJoin) ((_pJoin)->probe->primCtx.type > 0 || (_pJoin)->build->primCtx.type > 0)
#define GRP_REMAIN_ROWS(_grp) ((_grp)->endIdx - (_grp)->readIdx + 1)
#define GRP_DONE(_grp) ((_grp)->readIdx > (_grp)->endIdx)

View File

@ -894,21 +894,7 @@ static int32_t mJoinInitFinColsInfo(SMJoinTableCtx* pTable, SNodeList* pList) {
return TSDB_CODE_SUCCESS;
}
static int32_t mJoinInitPrimExprCtx(SNode* pNode, SMJoinPrimExprCtx* pCtx, SMJoinTableCtx* pTable) {
if (NULL == pNode) {
pCtx->targetSlotId = pTable->primCol->srcSlot;
return TSDB_CODE_SUCCESS;
}
if (QUERY_NODE_TARGET != nodeType(pNode)) {
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
STargetNode* pTarget = (STargetNode*)pNode;
if (QUERY_NODE_FUNCTION != nodeType(pTarget->pExpr)) {
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
static int32_t mJoinInitFuncPrimExprCtx(SMJoinPrimExprCtx* pCtx, STargetNode* pTarget) {
SFunctionNode* pFunc = (SFunctionNode*)pTarget->pExpr;
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType) {
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
@ -939,6 +925,47 @@ static int32_t mJoinInitPrimExprCtx(SNode* pNode, SMJoinPrimExprCtx* pCtx, SMJoi
pCtx->timezoneUnit = offsetFromTz(varDataVal(pTimeZone->datum.p), TSDB_TICK_PER_SECOND(pFunc->node.resType.precision));
}
pCtx->type = E_PRIM_TIMETRUNCATE;
return TSDB_CODE_SUCCESS;
}
static int32_t mJoinInitValPrimExprCtx(SMJoinPrimExprCtx* pCtx, STargetNode* pTarget) {
SValueNode* pVal = (SValueNode*)pTarget->pExpr;
if (TSDB_DATA_TYPE_TIMESTAMP != pVal->node.resType.type) {
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
pCtx->constTs = pVal->datum.i;
pCtx->type = E_PRIM_VALUE;
return TSDB_CODE_SUCCESS;
}
static int32_t mJoinInitPrimExprCtx(SNode* pNode, SMJoinPrimExprCtx* pCtx, SMJoinTableCtx* pTable) {
if (NULL == pNode) {
pCtx->targetSlotId = pTable->primCol->srcSlot;
return TSDB_CODE_SUCCESS;
}
if (QUERY_NODE_TARGET != nodeType(pNode)) {
qError("primary expr node is not target, type:%d", nodeType(pNode));
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
STargetNode* pTarget = (STargetNode*)pNode;
if (QUERY_NODE_FUNCTION != nodeType(pTarget->pExpr) && QUERY_NODE_VALUE != nodeType(pTarget->pExpr)) {
qError("Invalid primary expr node type:%d", nodeType(pTarget->pExpr));
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
if (QUERY_NODE_FUNCTION == nodeType(pTarget->pExpr)) {
MJ_ERR_RET(mJoinInitFuncPrimExprCtx(pCtx, pTarget));
} else if (QUERY_NODE_VALUE == nodeType(pTarget->pExpr)) {
MJ_ERR_RET(mJoinInitValPrimExprCtx(pCtx, pTarget));
}
pCtx->targetSlotId = pTarget->slotId;
return TSDB_CODE_SUCCESS;
@ -1045,25 +1072,36 @@ int32_t mJoinLaunchPrimExpr(SSDataBlock* pBlock, SMJoinTableCtx* pTable) {
return TSDB_CODE_SUCCESS;
}
SMJoinPrimExprCtx* pCtx = &pTable->primCtx;
SColumnInfoData* pPrimIn = taosArrayGet(pBlock->pDataBlock, pTable->primCol->srcSlot);
if (NULL == pPrimIn) {
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
SColumnInfoData* pPrimOut = taosArrayGet(pBlock->pDataBlock, pTable->primCtx.targetSlotId);
if (NULL == pPrimOut) {
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
if (0 != pCtx->timezoneUnit) {
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
((int64_t*)pPrimOut->pData)[i] = ((int64_t*)pPrimIn->pData)[i] - (((int64_t*)pPrimIn->pData)[i] + pCtx->timezoneUnit) % pCtx->truncateUnit;
SMJoinPrimExprCtx* pCtx = &pTable->primCtx;
switch (pCtx->type) {
case E_PRIM_TIMETRUNCATE: {
SColumnInfoData* pPrimIn = taosArrayGet(pBlock->pDataBlock, pTable->primCol->srcSlot);
if (NULL == pPrimIn) {
return TSDB_CODE_QRY_EXECUTOR_INTERNAL_ERROR;
}
if (0 != pCtx->timezoneUnit) {
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
((int64_t*)pPrimOut->pData)[i] = ((int64_t*)pPrimIn->pData)[i] - (((int64_t*)pPrimIn->pData)[i] + pCtx->timezoneUnit) % pCtx->truncateUnit;
}
} else {
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
((int64_t*)pPrimOut->pData)[i] = ((int64_t*)pPrimIn->pData)[i] / pCtx->truncateUnit * pCtx->truncateUnit;
}
}
break;
}
} else {
for (int32_t i = 0; i < pBlock->info.rows; ++i) {
((int64_t*)pPrimOut->pData)[i] = ((int64_t*)pPrimIn->pData)[i] / pCtx->truncateUnit * pCtx->truncateUnit;
case E_PRIM_VALUE: {
MJ_ERR_RET(colDataSetNItems(pPrimOut, 0, (char*)&pCtx->constTs, pBlock->info.rows, false));
break;
}
default:
break;
}
return TSDB_CODE_SUCCESS;

View File

@ -102,9 +102,11 @@ 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);
COPY_SCALAR_FIELD(joinSrc);
COPY_SCALAR_FIELD(projIdx);
COPY_SCALAR_FIELD(relatedTo);
COPY_SCALAR_FIELD(bindExprID);
@ -242,6 +244,7 @@ static int32_t tableNodeCopy(const STableNode* pSrc, STableNode* pDst) {
COPY_CHAR_ARRAY_FIELD(tableAlias);
COPY_SCALAR_FIELD(precision);
COPY_SCALAR_FIELD(singleTable);
COPY_SCALAR_FIELD(inJoin);
return TSDB_CODE_SUCCESS;
}
@ -321,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);
@ -542,6 +549,11 @@ static int32_t logicJoinCopy(const SJoinLogicNode* pSrc, SJoinLogicNode* pDst) {
COPY_SCALAR_FIELD(grpJoin);
COPY_SCALAR_FIELD(hashJoinHint);
COPY_SCALAR_FIELD(batchScanHint);
COPY_SCALAR_FIELD(noPrimKeyEqCond);
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

@ -3280,3 +3280,76 @@ void rewriteExprAliasName(SExprNode* pNode, int64_t num) {
bool isRelatedToOtherExpr(SExprNode* pExpr) {
return pExpr->relatedTo != 0;
}
typedef struct SContainsColCxt {
bool containsCol;
} SContainsColCxt;
static EDealRes nodeContainsCol(SNode* pNode, void* pContext) {
SContainsColCxt* pCxt = pContext;
if (QUERY_NODE_COLUMN == nodeType(pNode)) {
pCxt->containsCol = true;
return DEAL_RES_END;
}
return DEAL_RES_CONTINUE;
}
bool nodesContainsColumn(SNode* pNode) {
if (NULL == pNode) {
return false;
}
SContainsColCxt cxt = {0};
nodesWalkExpr(pNode, nodeContainsCol, &cxt);
return cxt.containsCol;
}
int32_t mergeNodeToLogic(SNode** pDst, SNode** pSrc) {
SLogicConditionNode* pLogicCond = NULL;
int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogicCond);
if (NULL == pLogicCond) {
return code;
}
pLogicCond->node.resType.type = TSDB_DATA_TYPE_BOOL;
pLogicCond->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
pLogicCond->condType = LOGIC_COND_TYPE_AND;
code = nodesListMakeAppend(&pLogicCond->pParameterList, *pSrc);
if (TSDB_CODE_SUCCESS == code) {
*pSrc = NULL;
code = nodesListMakeAppend(&pLogicCond->pParameterList, *pDst);
}
if (TSDB_CODE_SUCCESS == code) {
*pDst = (SNode*)pLogicCond;
} else {
nodesDestroyNode((SNode*)pLogicCond);
}
return code;
}
int32_t nodesMergeNode(SNode** pCond, SNode** pAdditionalCond) {
if (NULL == *pCond) {
TSWAP(*pCond, *pAdditionalCond);
return TSDB_CODE_SUCCESS;
}
int32_t code = TSDB_CODE_SUCCESS;
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*pCond) &&
LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)*pCond)->condType) {
code = nodesListAppend(((SLogicConditionNode*)*pCond)->pParameterList, *pAdditionalCond);
if (TSDB_CODE_SUCCESS == code) {
*pAdditionalCond = NULL;
}
} else {
code = mergeNodeToLogic(pCond, pAdditionalCond);
}
return code;
}

View File

@ -42,12 +42,12 @@ int32_t translatePostCreateStream(SParseContext* pParseCxt, SQuery* pQuery, SSDa
int32_t translatePostCreateSmaIndex(SParseContext* pParseCxt, SQuery* pQuery, SSDataBlock* pBlock);
int32_t translatePostCreateTSMA(SParseContext* pParseCxt, SQuery* pQuery, SSDataBlock* pBlock);
int32_t buildQueryAfterParse(SQuery** pQuery, SNode* pRootNode, int16_t placeholderNo, SArray** pPlaceholderValues);
int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinParent);
int32_t translateTable(STranslateContext* pCxt, SNode** pTable, bool inJoin);
int32_t getMetaDataFromHash(const char* pKey, int32_t len, SHashObj* pHash, void** pOutput);
void tfreeSParseQueryRes(void* p);
#ifdef TD_ENTERPRISE
int32_t translateView(STranslateContext* pCxt, SNode** pTable, SName* pName);
int32_t translateView(STranslateContext* pCxt, SNode** pTable, SName* pName, bool inJoin);
int32_t getViewMetaFromMetaCache(STranslateContext* pCxt, SName* pName, SViewMeta** ppViewMeta);
#endif
#ifdef __cplusplus

View File

@ -118,6 +118,39 @@ static int32_t calcConstCondition(SCalcConstContext* pCxt, SNode** pNode) {
return code;
}
static EDealRes rewriteCalcConstValue(SNode** pNode, void* pContext) {
int32_t code = TSDB_CODE_SUCCESS;
int32_t lino = 0;
SCalcConstContext* pCtx = (SCalcConstContext*)pContext;
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*pNode)) {
return DEAL_RES_CONTINUE;
} else if (QUERY_NODE_OPERATOR == nodeType(*pNode)) {
SOperatorNode* pOp = (SOperatorNode*)*pNode;
if (OP_TYPE_EQUAL == pOp->opType && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode*)pOp->pLeft)->resType.type || TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode*)pOp->pRight)->resType.type)) {
code = calcConstNode(&pOp->pLeft);
if (TSDB_CODE_SUCCESS == code) {
code = calcConstNode(&pOp->pRight);
}
goto _end;
}
}
if (TSDB_CODE_SUCCESS == code) {
code = calcConstCondition(pCtx, pNode);
}
_end:
if (code != TSDB_CODE_SUCCESS) {
qError("%s failed at line %d since %s", __func__, lino, tstrerror(code));
return DEAL_RES_ERROR;
}
return DEAL_RES_IGNORE_CHILD;
}
static int32_t rewriteConditionForFromTable(SCalcConstContext* pCxt, SNode* pTable) {
int32_t code = TSDB_CODE_SUCCESS;
switch (nodeType(pTable)) {
@ -127,13 +160,32 @@ 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 = rewriteCondition(pCxt, &pJoin->pOnCond);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pOnCond) {
nodesRewriteExpr(&pJoin->pOnCond, rewriteCalcConstValue, pCxt);
}
/*
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pOnCond) {
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;
}
nodesDestroyNode(pCond);
*/
// todo empty table
break;
}
@ -207,6 +259,7 @@ static int32_t findAndReplaceNode(SCalcConstContext* pCxt, SNode** pRoot, SNode*
static int32_t calcConstProject(SCalcConstContext* pCxt, SNode* pProject, bool dual, SNode** pNew) {
SArray* pAssociation = NULL;
if (NULL != ((SExprNode*)pProject)->pAssociation) {
pAssociation = taosArrayDup(((SExprNode*)pProject)->pAssociation, NULL);
if (NULL == pAssociation) {
@ -214,7 +267,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);
@ -227,8 +280,16 @@ static int32_t calcConstProject(SCalcConstContext* pCxt, SNode* pProject, bool d
for (int32_t i = 0; i < size; ++i) {
SAssociationNode* pAssNode = taosArrayGet(pAssociation, i);
SNode** pCol = pAssNode->pPlace;
if (((SExprNode*)pAssNode->pAssociationNode)->joinSrc) {
//((SExprNode*)pAssNode->pAssociationNode)->constValue = 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);
@ -236,6 +297,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

@ -1383,7 +1383,7 @@ static void setColumnInfoBySchema(const SRealTableNode* pTable, const SSchema* p
pCol->numOfPKs = pTable->pMeta->tableInfo.numOfPKs;
}
static int32_t setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SColumnNode** pColRef) {
static int32_t setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SColumnNode** pColRef, bool joinSrc) {
SColumnNode* pCol = *pColRef;
if (NULL == pExpr->pAssociation) {
@ -1413,6 +1413,7 @@ static int32_t setColumnInfoByExpr(STempTableNode* pTable, SExprNode* pExpr, SCo
tstrncpy(pCol->node.userAlias, pExpr->userAlias, TSDB_COL_NAME_LEN);
}
pCol->node.resType = pExpr->resType;
pCol->node.joinSrc = pTable->table.inJoin && joinSrc;
return TSDB_CODE_SUCCESS;
}
@ -1494,7 +1495,7 @@ static int32_t createColumnsByTable(STranslateContext* pCxt, const STableNode* p
code = nodesListStrictAppend(pList, (SNode*)pCol);
if (TSDB_CODE_SUCCESS == code) {
SListCell* pCell = nodesListGetCell(pList, LIST_LENGTH(pList) - 1);
code = setColumnInfoByExpr(pTempTable, (SExprNode*)pNode, (SColumnNode**)&pCell->pNode);
code = setColumnInfoByExpr(pTempTable, (SExprNode*)pNode, (SColumnNode**)&pCell->pNode, true);
}
if (TSDB_CODE_SUCCESS == code) {
if (!skipProjRef)
@ -1591,7 +1592,7 @@ static int32_t findAndSetColumn(STranslateContext* pCxt, SColumnNode** pColRef,
}
}
if (pFoundExpr) {
code = setColumnInfoByExpr(pTempTable, pFoundExpr, pColRef);
code = setColumnInfoByExpr(pTempTable, pFoundExpr, pColRef, SQL_CLAUSE_FROM != pCxt->currClause);
if (TSDB_CODE_SUCCESS != code) {
return code;
}
@ -4753,14 +4754,25 @@ static int32_t checkJoinTable(STranslateContext* pCxt, SJoinTableNode* pJoinTabl
}
}
if ((QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pLeft) &&
!isGlobalTimeLineQuery(((STempTableNode*)pJoinTable->pLeft)->pSubquery)) ||
(QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pRight) &&
!isGlobalTimeLineQuery(((STempTableNode*)pJoinTable->pRight)->pSubquery))) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SUPPORT_JOIN,
"Join requires valid time series input");
if (QUERY_NODE_TEMP_TABLE == nodeType(pJoinTable->pLeft) &&
!isGlobalTimeLineQuery(((STempTableNode*)pJoinTable->pLeft)->pSubquery)) {
if (IS_ASOF_JOIN(pJoinTable->subType) || IS_WINDOW_JOIN(pJoinTable->subType)) {
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) &&
!isGlobalTimeLineQuery(((STempTableNode*)pJoinTable->pRight)->pSubquery)) {
if (IS_ASOF_JOIN(pJoinTable->subType) || IS_WINDOW_JOIN(pJoinTable->subType)) {
return generateSyntaxErrMsgExt(&pCxt->msgBuf, TSDB_CODE_PAR_NOT_SUPPORT_JOIN,
"Join requires valid time series input");
}
pJoinTable->rightNoOrderedSubQuery = true;
}
return TSDB_CODE_SUCCESS;
}
@ -5088,9 +5100,141 @@ static int32_t setJoinTimeLineResMode(STranslateContext* pCxt) {
return TSDB_CODE_SUCCESS;
}
int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinParent) {
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;
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc) && ((SLogicConditionNode*)*ppSrc)->condType == LOGIC_COND_TYPE_AND) {
SLogicConditionNode* pSrcLogic = (SLogicConditionNode*)*ppSrc;
code = nodesListMakeStrictAppendList(&pLogic->pParameterList, pSrcLogic->pParameterList);
if (TSDB_CODE_SUCCESS == code) {
pSrcLogic->pParameterList = NULL;
nodesDestroyNode(*ppSrc);
*ppSrc = NULL;
}
} else {
code = nodesListMakeStrictAppend(&pLogic->pParameterList, *ppSrc);
if (TSDB_CODE_SUCCESS == code) {
*ppSrc = NULL;
}
}
return code;
}
if (TSDB_CODE_SUCCESS == code && QUERY_NODE_LOGIC_CONDITION == nodeType(*ppSrc) && ((SLogicConditionNode*)*ppSrc)->condType == LOGIC_COND_TYPE_AND) {
SNode* pTmp = *ppDst;
*ppDst = *ppSrc;
*ppSrc = pTmp;
continue;
}
if (TSDB_CODE_SUCCESS == code) {
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;
}
bool isColumnExpr(SNode* pNode) {
SExprNode* pExpr = (SExprNode*)pNode;
if (QUERY_NODE_COLUMN != nodeType(pNode) && QUERY_NODE_FUNCTION != nodeType(pNode)) {
return false;
}
if (QUERY_NODE_FUNCTION == nodeType(pNode)) {
SFunctionNode* pFunc = (SFunctionNode*)pNode;
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType && strcasecmp(((SFunctionNode*)pNode)->functionName, "timetruncate")) {
return false;
}
if (!nodesContainsColumn(nodesListGetNode(pFunc->pParameterList, 0))) {
return false;
}
}
return true;
}
int32_t splitJoinColPrimaryCond(SNode** ppSrc, SNode** ppDst) {
if (NULL == *ppSrc) {
return TSDB_CODE_SUCCESS;
}
int32_t code = 0;
switch (nodeType(*ppSrc)) {
case QUERY_NODE_OPERATOR: {
SOperatorNode* pOp = (SOperatorNode*)*ppSrc;
if (OP_TYPE_EQUAL != pOp->opType) {
break;
}
if (isColumnExpr(pOp->pLeft) && isColumnExpr(pOp->pRight)) {
TSWAP(*ppSrc, *ppDst);
}
break;
}
case QUERY_NODE_LOGIC_CONDITION: {
SLogicConditionNode* pLogic = (SLogicConditionNode*)*ppSrc;
if (LOGIC_COND_TYPE_AND != pLogic->condType) {
break;
}
SNode* pTmp = NULL;
SNode* pTmpRes = NULL;
WHERE_EACH(pTmp, pLogic->pParameterList) {
code = splitJoinColPrimaryCond(&pTmp, &pTmpRes);
if (code) {
break;
}
if (NULL == pTmp && NULL != pTmpRes) {
cell->pNode = NULL;
ERASE_NODE(pLogic->pParameterList);
code = nodesMergeNode(ppDst, &pTmpRes);
if (code) {
break;
}
continue;
}
WHERE_NEXT;
}
if (pLogic->pParameterList->length <= 0) {
nodesDestroyNode(*ppSrc);
*ppSrc = NULL;
}
break;
}
default:
break;
}
return code;
}
int32_t translateTable(STranslateContext* pCxt, SNode** pTable, bool inJoin) {
SSelectStmt* pCurrSmt = (SSelectStmt*)(pCxt->pCurrStmt);
int32_t code = TSDB_CODE_SUCCESS;
((STableNode*)*pTable)->inJoin = inJoin;
switch (nodeType(*pTable)) {
case QUERY_NODE_REAL_TABLE: {
SRealTableNode* pRealTable = (SRealTableNode*)*pTable;
@ -5106,7 +5250,7 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare
}
#ifdef TD_ENTERPRISE
if (TSDB_VIEW_TABLE == pRealTable->pMeta->tableType && (!pCurrSmt->tagScan || pCxt->pParseCxt->biMode)) {
return translateView(pCxt, pTable, &name);
return translateView(pCxt, pTable, &name, inJoin);
}
code = translateAudit(pCxt, pRealTable, &name);
#endif
@ -5163,14 +5307,27 @@ int32_t translateTable(STranslateContext* pCxt, SNode** pTable, SNode* pJoinPare
SJoinTableNode* pJoinTable = (SJoinTableNode*)*pTable;
code = translateJoinTable(pCxt, pJoinTable);
if (TSDB_CODE_SUCCESS == code) {
code = translateTable(pCxt, &pJoinTable->pLeft, (SNode*)pJoinTable);
code = translateTable(pCxt, &pJoinTable->pLeft, true);
}
if (TSDB_CODE_SUCCESS == code) {
code = translateTable(pCxt, &pJoinTable->pRight, (SNode*)pJoinTable);
code = translateTable(pCxt, &pJoinTable->pRight, true);
}
if (TSDB_CODE_SUCCESS == code) {
code = checkJoinTable(pCxt, pJoinTable);
}
if (TSDB_CODE_SUCCESS == code && !inJoin && pCurrSmt->pWhere && JOIN_TYPE_INNER == pJoinTable->joinType) {
SNode* pPrimCond = NULL;
code = splitJoinColPrimaryCond(&pCurrSmt->pWhere, &pPrimCond);
if (TSDB_CODE_SUCCESS == code && pPrimCond) {
if (pJoinTable->pOnCond) {
code = mergeInnerJoinConds(&pJoinTable->pOnCond, &pPrimCond);
} else {
pJoinTable->pOnCond = pPrimCond;
pPrimCond = NULL;
}
}
nodesDestroyNode(pPrimCond);
}
if (TSDB_CODE_SUCCESS == code) {
pJoinTable->table.precision = calcJoinTablePrecision(pJoinTable);
pJoinTable->table.singleTable = joinTableIsSingleTable(pJoinTable);
@ -7123,7 +7280,7 @@ static int32_t translateWhere(STranslateContext* pCxt, SSelectStmt* pSelect) {
static int32_t translateFrom(STranslateContext* pCxt, SNode** pTable) {
pCxt->currClause = SQL_CLAUSE_FROM;
return translateTable(pCxt, pTable, NULL);
return translateTable(pCxt, pTable, false);
}
static int32_t checkLimit(STranslateContext* pCxt, SSelectStmt* pSelect) {
@ -7555,7 +7712,7 @@ static EDealRes rewriteSingleColsFunc(SNode** pNode, void* pContext) {
}
if (pFunc->node.asAlias) {
if (((SExprNode*)pExpr)->asAlias) {
pCxt->status = TSDB_CODE_INVALID_COLS_ALIAS;
pCxt->status = TSDB_CODE_PAR_INVALID_COLS_ALIAS;
parserError("%s Invalid using alias for cols function", __func__);
return DEAL_RES_ERROR;
} else {
@ -7664,7 +7821,7 @@ static int32_t rewriteColsFunction(STranslateContext* pCxt, SNodeList** nodeList
if (isMultiColsFuncNode(pTmpNode)) {
SFunctionNode* pFunc = (SFunctionNode*)pTmpNode;
if(pFunc->node.asAlias) {
code = TSDB_CODE_INVALID_COLS_ALIAS;
code = TSDB_CODE_PAR_INVALID_COLS_ALIAS;
parserError("%s Invalid using alias for cols function", __func__);
goto _end;
}

View File

@ -600,6 +600,9 @@ 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) {
code = nodesCloneNode(pJoinTable->pJLimit, &pJoin->pJLimit);

View File

@ -20,6 +20,7 @@
#include "systable.h"
#include "tglobal.h"
#include "ttime.h"
#include "scalar.h"
#define OPTIMIZE_FLAG_MASK(n) (1 << n)
@ -502,52 +503,12 @@ static int32_t scanPathOptimize(SOptimizeContext* pCxt, SLogicSubplan* pLogicSub
return code;
}
static int32_t pdcMergeCondsToLogic(SNode** pDst, SNode** pSrc) {
SLogicConditionNode* pLogicCond = NULL;
int32_t code = nodesMakeNode(QUERY_NODE_LOGIC_CONDITION, (SNode**)&pLogicCond);
if (NULL == pLogicCond) {
return code;
}
pLogicCond->node.resType.type = TSDB_DATA_TYPE_BOOL;
pLogicCond->node.resType.bytes = tDataTypes[TSDB_DATA_TYPE_BOOL].bytes;
pLogicCond->condType = LOGIC_COND_TYPE_AND;
code = nodesListMakeAppend(&pLogicCond->pParameterList, *pSrc);
if (TSDB_CODE_SUCCESS == code) {
*pSrc = NULL;
code = nodesListMakeAppend(&pLogicCond->pParameterList, *pDst);
}
if (TSDB_CODE_SUCCESS == code) {
*pDst = (SNode*)pLogicCond;
} else {
nodesDestroyNode((SNode*)pLogicCond);
}
return code;
}
static int32_t pdcMergeConds(SNode** pCond, SNode** pAdditionalCond) {
if (NULL == *pCond) {
TSWAP(*pCond, *pAdditionalCond);
return TSDB_CODE_SUCCESS;
}
int32_t code = TSDB_CODE_SUCCESS;
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*pCond) &&
LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)*pCond)->condType) {
code = nodesListAppend(((SLogicConditionNode*)*pCond)->pParameterList, *pAdditionalCond);
if (TSDB_CODE_SUCCESS == code) {
*pAdditionalCond = NULL;
}
} else {
code = pdcMergeCondsToLogic(pCond, pAdditionalCond);
}
return code;
}
static int32_t pushDownCondOptCalcTimeRange(SOptimizeContext* pCxt, SScanLogicNode* pScan, SNode** pPrimaryKeyCond,
SNode** pOtherCond) {
int32_t code = TSDB_CODE_SUCCESS;
if (pCxt->pPlanCxt->topicQuery || pCxt->pPlanCxt->streamQuery) {
code = pdcMergeConds(pOtherCond, pPrimaryKeyCond);
code = nodesMergeNode(pOtherCond, pPrimaryKeyCond);
} else {
bool isStrict = false;
code = filterGetTimeRange(*pPrimaryKeyCond, &pScan->scanRange, &isStrict);
@ -555,7 +516,7 @@ static int32_t pushDownCondOptCalcTimeRange(SOptimizeContext* pCxt, SScanLogicNo
if (isStrict) {
nodesDestroyNode(*pPrimaryKeyCond);
} else {
code = pdcMergeConds(pOtherCond, pPrimaryKeyCond);
code = nodesMergeNode(pOtherCond, pPrimaryKeyCond);
}
*pPrimaryKeyCond = NULL;
}
@ -629,8 +590,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;
@ -819,15 +788,27 @@ static int32_t pdcJoinSplitCond(SJoinLogicNode* pJoin, SNode** pSrcCond, SNode**
}
static int32_t pdcJoinPushDownOnCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin, SNode** pCond) {
return pdcMergeConds(&pJoin->pFullOnCond, pCond);
return nodesMergeNode(&pJoin->pFullOnCond, pCond);
}
static int32_t pdcPushDownCondToChild(SOptimizeContext* pCxt, SLogicNode* pChild, SNode** pCond) {
return pdcMergeConds(&pChild->pConditions, pCond);
return nodesMergeNode(&pChild->pConditions, pCond);
}
static bool pdcJoinIsPrim(SNode* pNode, SSHashObj* pTables) {
if (QUERY_NODE_COLUMN != nodeType(pNode) && QUERY_NODE_FUNCTION != nodeType(pNode)) {
static bool pdcJoinIsPrim(SNode* pNode, SSHashObj* pTables, bool constAsPrim, bool* constPrimGot) {
if (QUERY_NODE_COLUMN != nodeType(pNode) && QUERY_NODE_FUNCTION != nodeType(pNode) && (!constAsPrim || QUERY_NODE_VALUE != nodeType(pNode))) {
return false;
}
if (QUERY_NODE_VALUE == nodeType(pNode)) {
SValueNode* pVal = (SValueNode*)pNode;
if (TSDB_DATA_TYPE_NULL != pVal->node.resType.type && !pVal->isNull) {
if (pdcJoinColInTableList(pNode, pTables)) {
*constPrimGot = true;
return true;
}
}
return false;
}
@ -850,7 +831,7 @@ static bool pdcJoinIsPrim(SNode* pNode, SSHashObj* pTables) {
return pdcJoinColInTableList(pNode, pTables);
}
static bool pdcJoinIsPrimEqualCond(SJoinLogicNode* pJoin, SNode* pCond) {
static bool pdcJoinIsPrimEqualCond(SJoinLogicNode* pJoin, SNode* pCond, bool constAsPrim) {
if (QUERY_NODE_OPERATOR != nodeType(pCond)) {
return false;
}
@ -878,11 +859,14 @@ static bool pdcJoinIsPrimEqualCond(SJoinLogicNode* pJoin, SNode* pCond) {
return code;
}
bool res = false;
if (pdcJoinIsPrim(pOper->pLeft, pLeftTables)) {
res = pdcJoinIsPrim(pOper->pRight, pRightTables);
} else if (pdcJoinIsPrim(pOper->pLeft, pRightTables)) {
res = pdcJoinIsPrim(pOper->pRight, pLeftTables);
bool res = false, constGot = false;
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);
}
}
tSimpleHashCleanup(pLeftTables);
@ -910,24 +894,26 @@ static bool pdcJoinHasPrimEqualCond(SJoinLogicNode* pJoin, SNode* pCond, bool* e
}
return hasPrimaryKeyEqualCond;
} else {
return pdcJoinIsPrimEqualCond(pJoin, pCond);
return pdcJoinIsPrimEqualCond(pJoin, pCond, false);
}
}
static int32_t pdcJoinSplitPrimInLogicCond(SJoinLogicNode* pJoin, SNode** ppPrimEqCond, SNode** ppOnCond) {
SLogicConditionNode* pLogicCond = (SLogicConditionNode*)(pJoin->pFullOnCond);
static int32_t pdcJoinSplitPrimInLogicCond(SJoinLogicNode* pJoin, SNode** ppInput, SNode** ppPrimEqCond, SNode** ppOnCond, bool constAsPrim) {
SLogicConditionNode* pLogicCond = (SLogicConditionNode*)(*ppInput);
int32_t code = TSDB_CODE_SUCCESS;
SNodeList* pOnConds = NULL;
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) && (NULL == *ppPrimEqCond)) {
if (pdcJoinIsPrimEqualCond(pJoin, pCond, constAsPrim) && (NULL == *ppPrimEqCond) && (!constAsPrim || pJoin->leftConstPrimGot || pJoin->rightConstPrimGot)) {
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;
@ -942,10 +928,11 @@ static int32_t pdcJoinSplitPrimInLogicCond(SJoinLogicNode* pJoin, SNode** ppPrim
if (TSDB_CODE_SUCCESS == code) {
if (NULL != *ppPrimEqCond) {
*ppOnCond = pTempOnCond;
nodesDestroyNode(pJoin->pFullOnCond);
pJoin->pFullOnCond = NULL;
nodesDestroyNode(*ppInput);
*ppInput = NULL;
return TSDB_CODE_SUCCESS;
}
nodesDestroyNode(pTempOnCond);
planError("no primary key equal cond found, condListNum:%d", pLogicCond->pParameterList->length);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
} else {
@ -962,8 +949,8 @@ static int32_t pdcJoinSplitPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNode* pJ
if (QUERY_NODE_LOGIC_CONDITION == nodeType(pJoin->pFullOnCond) &&
LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)(pJoin->pFullOnCond))->condType) {
code = pdcJoinSplitPrimInLogicCond(pJoin, &pPrimKeyEqCond, &pJoinOnCond);
} else if (pdcJoinIsPrimEqualCond(pJoin, pJoin->pFullOnCond)) {
code = pdcJoinSplitPrimInLogicCond(pJoin, &pJoin->pFullOnCond, &pPrimKeyEqCond, &pJoinOnCond, false);
} else if (pdcJoinIsPrimEqualCond(pJoin, pJoin->pFullOnCond, false)) {
pPrimKeyEqCond = pJoin->pFullOnCond;
pJoinOnCond = NULL;
} else {
@ -1412,6 +1399,37 @@ static int32_t pdcJoinAddFilterColsToTarget(SOptimizeContext* pCxt, SJoinLogicNo
return code;
}
static int32_t pdcJoinSplitConstPrimEqCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin, SNode** ppCond) {
int32_t code = TSDB_CODE_SUCCESS;
SNode* pPrimKeyEqCond = NULL;
SNode* pJoinOnCond = NULL;
if (QUERY_NODE_LOGIC_CONDITION == nodeType(*ppCond) &&
LOGIC_COND_TYPE_AND == ((SLogicConditionNode*)*ppCond)->condType) {
code = pdcJoinSplitPrimInLogicCond(pJoin, ppCond, &pPrimKeyEqCond, &pJoinOnCond, true);
} else if (pdcJoinIsPrimEqualCond(pJoin, *ppCond, true) && (pJoin->leftConstPrimGot || pJoin->rightConstPrimGot)) {
pPrimKeyEqCond = *ppCond;
pJoinOnCond = NULL;
} else {
return TSDB_CODE_SUCCESS;
}
if (TSDB_CODE_SUCCESS == code) {
pJoin->pPrimKeyEqCond = pPrimKeyEqCond;
*ppCond = pJoinOnCond;
if (pJoin->rightConstPrimGot || pJoin->leftConstPrimGot) {
code = scalarConvertOpValueNodeTs((SOperatorNode*)pJoin->pPrimKeyEqCond);
}
} else {
nodesDestroyNode(pPrimKeyEqCond);
nodesDestroyNode(pJoinOnCond);
}
return code;
}
static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) {
if (NULL == pJoin->pFullOnCond) {
if (IS_WINDOW_JOIN(pJoin->subType) || IS_ASOF_JOIN(pJoin->subType)) {
@ -1427,9 +1445,10 @@ static int32_t pdcJoinCheckAllCond(SOptimizeContext* pCxt, SJoinLogicNode* pJoin
}
}
SNode* pCond = pJoin->pFullOnCond ? pJoin->pFullOnCond : pJoin->node.pConditions;
SNode** ppCond = pJoin->pFullOnCond ? &pJoin->pFullOnCond : &pJoin->node.pConditions;
bool errCond = false;
if (!pdcJoinHasPrimEqualCond(pJoin, pCond, &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);
@ -1437,7 +1456,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) {
@ -1448,6 +1468,22 @@ 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)) {
return code;
}
if (IS_INNER_NONE_JOIN(pJoin->joinType, pJoin->subType) && NULL != pJoin->pFullOnCond &&
NULL != pJoin->node.pConditions) {
code = pdcJoinSplitConstPrimEqCond(pCxt, pJoin, &pJoin->node.pConditions);
if (code || pJoin->pPrimKeyEqCond) {
return code;
}
}
return generateUsageErrMsg(pCxt->pPlanCxt->pMsg, pCxt->pPlanCxt->msgLen, TSDB_CODE_PLAN_EXPECTED_TS_EQUAL);
}
@ -1813,6 +1849,7 @@ static int32_t pdcRewriteTypeBasedOnJoinRes(SOptimizeContext* pCxt, SJoinLogicNo
return TSDB_CODE_SUCCESS;
}
static int32_t pdcDealJoin(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) {
if (OPTIMIZE_FLAG_TEST_MASK(pJoin->node.optimizedFlag, OPTIMIZE_FLAG_PUSH_DOWN_CONDE)) {
return TSDB_CODE_SUCCESS;
@ -1870,7 +1907,7 @@ static int32_t pdcDealJoin(SOptimizeContext* pCxt, SJoinLogicNode* pJoin) {
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->pFullOnCond && !IS_WINDOW_JOIN(pJoin->subType) &&
NULL == pJoin->addPrimEqCond) {
NULL == pJoin->addPrimEqCond && NULL == pJoin->pPrimKeyEqCond) {
code = pdcJoinSplitPrimEqCond(pCxt, pJoin);
}
@ -1993,7 +2030,7 @@ static int32_t partitionAggCond(SAggLogicNode* pAgg, SNode** ppAggFunCond, SNode
}
static int32_t pushCondToAggCond(SOptimizeContext* pCxt, SAggLogicNode* pAgg, SNode** pAggFuncCond) {
return pdcMergeConds(&pAgg->node.pConditions, pAggFuncCond);
return nodesMergeNode(&pAgg->node.pConditions, pAggFuncCond);
}
typedef struct SRewriteAggGroupKeyCondContext {
@ -2619,7 +2656,9 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL
bool res = false;
SOperatorNode* pOp = (SOperatorNode*)pJoin->pPrimKeyEqCond;
if (QUERY_NODE_COLUMN != nodeType(pOp->pLeft) || QUERY_NODE_COLUMN != nodeType(pOp->pRight)) {
if ((QUERY_NODE_COLUMN != nodeType(pOp->pLeft) && QUERY_NODE_VALUE != nodeType(pOp->pLeft)) ||
(QUERY_NODE_COLUMN != nodeType(pOp->pRight) && QUERY_NODE_VALUE != nodeType(pOp->pRight))) {
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
@ -2629,11 +2668,13 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL
if (TSDB_CODE_SUCCESS != code) {
return code;
}
if (NULL !=
tSimpleHashGet(pTables, ((SColumnNode*)pOp->pLeft)->tableAlias, strlen(((SColumnNode*)pOp->pLeft)->tableAlias))) {
char* opLeftTable = (QUERY_NODE_COLUMN == nodeType(pOp->pLeft)) ? ((SColumnNode*)pOp->pLeft)->tableAlias : ((SValueNode*)pOp->pLeft)->node.srcTable;
char* opRightTable = (QUERY_NODE_COLUMN == nodeType(pOp->pRight)) ? ((SColumnNode*)pOp->pRight)->tableAlias : ((SValueNode*)pOp->pRight)->node.srcTable;
if (NULL != tSimpleHashGet(pTables, opLeftTable, strlen(opLeftTable))) {
pOrderByNode = pOp->pLeft;
} else if (NULL != tSimpleHashGet(pTables, ((SColumnNode*)pOp->pRight)->tableAlias,
strlen(((SColumnNode*)pOp->pRight)->tableAlias))) {
} else if (NULL != tSimpleHashGet(pTables, opRightTable, strlen(opRightTable))) {
pOrderByNode = pOp->pRight;
}
@ -2686,7 +2727,6 @@ static int32_t sortForJoinOptimizeImpl(SOptimizeContext* pCxt, SLogicSubplan* pL
}
*pChildPos = (SNode*)pSort;
pSort->node.pParent = (SLogicNode*)pJoin;
;
_return:

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);
@ -924,7 +927,7 @@ static int32_t setColEqList(SNode* pEqCond, int16_t leftBlkId, int16_t rightBlkI
}
static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_t leftBlkId, int16_t rightBlkId,
SSortMergeJoinPhysiNode* pJoin) {
SSortMergeJoinPhysiNode* pJoin, SJoinLogicNode* pJoinLogicNode) {
int32_t code = 0;
if (QUERY_NODE_OPERATOR == nodeType(pEqCond)) {
SOperatorNode* pOp = (SOperatorNode*)pEqCond;
@ -947,6 +950,16 @@ static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_
}
break;
}
case QUERY_NODE_VALUE: {
if (pJoinLogicNode && pJoinLogicNode->leftConstPrimGot) {
pJoin->leftPrimExpr = NULL;
code = nodesCloneNode(pOp->pLeft, &pJoin->leftPrimExpr);
break;
}
planError("value node got in prim eq left cond, rightType:%d", pOp->pRight ? nodeType(pOp->pRight) : 0);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
case QUERY_NODE_FUNCTION: {
SFunctionNode* pFunc = (SFunctionNode*)pOp->pLeft;
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType) {
@ -995,6 +1008,16 @@ static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_
}
break;
}
case QUERY_NODE_VALUE: {
if (pJoinLogicNode && pJoinLogicNode->rightConstPrimGot) {
pJoin->rightPrimExpr = NULL;
code = nodesCloneNode(pOp->pRight, &pJoin->rightPrimExpr);
break;
}
planError("value node got in prim eq right cond, leftType:%d", pOp->pLeft ? nodeType(pOp->pLeft) : 0);
return TSDB_CODE_PLAN_INTERNAL_ERROR;
}
case QUERY_NODE_FUNCTION: {
SFunctionNode* pFunc = (SFunctionNode*)pOp->pRight;
if (FUNCTION_TYPE_TIMETRUNCATE != pFunc->funcType) {
@ -1034,6 +1057,37 @@ static int32_t setMergeJoinPrimColEqCond(SNode* pEqCond, int32_t subType, int16_
return code;
}
static int32_t removePrimColFromJoinTargets(SNodeList* pTargets, SValueNode* pPrimExpr, SColumnNode** ppRemoved) {
int32_t code = TSDB_CODE_SUCCESS;
SNode* pNode = NULL;
FOREACH(pNode, pTargets) {
SColumnNode* pCol = (SColumnNode*)pNode;
if (0 == strcmp(pCol->tableAlias, pPrimExpr->node.srcTable) && 0 == strcmp(pCol->colName, pPrimExpr->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;
if (TSDB_DATA_TYPE_TIMESTAMP != pCol->node.resType.type) {
planError("primary key output type is not ts, type:%d", pCol->node.resType.type);
return TSDB_CODE_PAR_PRIM_KEY_MUST_BE_TS;
}
pCol->dataBlockId = blkId;
pCol->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 =
@ -1068,7 +1122,7 @@ static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
&pJoin->pPrimKeyCond);
if (TSDB_CODE_SUCCESS == code) {
code = setMergeJoinPrimColEqCond(pJoin->pPrimKeyCond, pJoin->subType, pLeftDesc->dataBlockId,
pRightDesc->dataBlockId, pJoin);
pRightDesc->dataBlockId, pJoin, pJoinLogicNode);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->leftPrimExpr) {
code = addDataBlockSlot(pCxt, &pJoin->leftPrimExpr, pLeftDesc);
@ -1084,7 +1138,7 @@ static int32_t createMergeJoinPhysiNode(SPhysiPlanContext* pCxt, SNodeList* pChi
&pPrimKeyCond);
if (TSDB_CODE_SUCCESS == code) {
code = setMergeJoinPrimColEqCond(pPrimKeyCond, pJoin->subType, pLeftDesc->dataBlockId, pRightDesc->dataBlockId,
pJoin);
pJoin, NULL);
}
if (TSDB_CODE_SUCCESS == code && NULL != pJoin->leftPrimExpr) {
code = addDataBlockSlot(pCxt, &pJoin->leftPrimExpr, pLeftDesc);
@ -1095,11 +1149,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);
@ -1151,6 +1226,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

@ -1133,29 +1133,7 @@ static uint8_t sclGetOpValueNodeTsPrecision(SNode *pLeft, SNode *pRight) {
return 0;
}
int32_t sclConvertOpValueNodeTs(SOperatorNode *node) {
if (node->pLeft && SCL_IS_VAR_VALUE_NODE(node->pLeft)) {
if (node->pRight && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pRight)->resType.type)) {
SCL_ERR_RET(
sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, node->pRight), (SValueNode *)node->pLeft));
}
} else if (node->pRight && SCL_IS_NOTNULL_CONST_NODE(node->pRight)) {
if (node->pLeft && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pLeft)->resType.type)) {
if (SCL_IS_VAR_VALUE_NODE(node->pRight)) {
SCL_ERR_RET(sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, node->pRight),
(SValueNode *)node->pRight));
} else if (QUERY_NODE_NODE_LIST == node->pRight->type) {
SNode *pNode;
FOREACH(pNode, ((SNodeListNode *)node->pRight)->pNodeList) {
if (SCL_IS_VAR_VALUE_NODE(pNode)) {
SCL_ERR_RET(sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, pNode), (SValueNode *)pNode));
}
}
}
}
}
return TSDB_CODE_SUCCESS;
}
int32_t sclConvertCaseWhenValueNodeTs(SCaseWhenNode *node) {
if (NULL == node->pCase) {
@ -1344,7 +1322,7 @@ EDealRes sclRewriteLogic(SNode **pNode, SScalarCtx *ctx) {
EDealRes sclRewriteOperator(SNode **pNode, SScalarCtx *ctx) {
SOperatorNode *node = (SOperatorNode *)*pNode;
ctx->code = sclConvertOpValueNodeTs(node);
ctx->code = scalarConvertOpValueNodeTs(node);
if (ctx->code) {
return DEAL_RES_ERROR;
}
@ -1807,6 +1785,31 @@ static int32_t sclGetBitwiseOperatorResType(SOperatorNode *pOp) {
return TSDB_CODE_SUCCESS;
}
int32_t scalarConvertOpValueNodeTs(SOperatorNode *node) {
if (node->pLeft && SCL_IS_VAR_VALUE_NODE(node->pLeft)) {
if (node->pRight && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pRight)->resType.type)) {
SCL_ERR_RET(
sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, node->pRight), (SValueNode *)node->pLeft));
}
} else if (node->pRight && SCL_IS_NOTNULL_CONST_NODE(node->pRight)) {
if (node->pLeft && (TSDB_DATA_TYPE_TIMESTAMP == ((SExprNode *)node->pLeft)->resType.type)) {
if (SCL_IS_VAR_VALUE_NODE(node->pRight)) {
SCL_ERR_RET(sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, node->pRight),
(SValueNode *)node->pRight));
} else if (QUERY_NODE_NODE_LIST == node->pRight->type) {
SNode *pNode;
FOREACH(pNode, ((SNodeListNode *)node->pRight)->pNodeList) {
if (SCL_IS_VAR_VALUE_NODE(pNode)) {
SCL_ERR_RET(sclConvertToTsValueNode(sclGetOpValueNodeTsPrecision(node->pLeft, pNode), (SValueNode *)pNode));
}
}
}
}
}
return TSDB_CODE_SUCCESS;
}
int32_t scalarCalculateConstants(SNode *pNode, SNode **pRes) { return sclCalcConstants(pNode, false, pRes); }
int32_t scalarCalculateConstantsFromDual(SNode *pNode, SNode **pRes) { return sclCalcConstants(pNode, true, pRes); }

View File

@ -757,9 +757,8 @@ TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TRUE_FOR_NEGATIVE, "True_for duration c
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_TRUE_FOR_UNIT, "Cannot use 'year' or 'month' as true_for duration")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLS_FUNCTION, "Invalid cols function")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLS_SELECTFUNC, "cols function's first param must be a select function that output a single row")
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_MULITI_COLS_FUNC, "Improper use of cols function with multiple output columns")
TAOS_DEFINE_ERROR(TSDB_CODE_INVALID_COLS_ALIAS, "Invalid using alias for cols function")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INVALID_COLS_ALIAS, "Invalid using alias for cols function")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_PRIM_KEY_MUST_BE_TS, "Join primary key col must be timestmap type")
TAOS_DEFINE_ERROR(TSDB_CODE_PAR_INTERNAL_ERROR, "Parser internal error")
//planner

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
taos> select * from a1 a join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
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 |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
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' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select a.*, b.ts from a1 a join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts |
================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:02.000 |
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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
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 |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
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 |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
==========================
__today__ 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta 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 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select * from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select * from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from (select today as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts, f, g, 'a' c from b1) b 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select 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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select 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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb 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' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
taos> select * from a1 a , (select today as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select today as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select b.ts1 from a1 a , (select today as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a , (select 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select today as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
==========================
__today__ 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select b.ts from (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select 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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select 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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select 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 |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select * from (select today as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select 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 |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select 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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select 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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
7 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
8 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
9 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
10 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
14 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
15 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
16 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
17 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 __today__ 00:00:00.000 | 101 | 1011 |
21 __today__ 00:00:00.000 | 101 | 1011 |
22 __today__ 00:00:00.000 | 101 | 1011 |
23 __today__ 00:00:00.000 | 101 | 1011 |
24 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 __today__ 00:00:00.000 | 301 | 3011 | a |
28 __today__ 00:00:00.000 | 302 | 3012 | a |
29 __today__ 00:00:00.000 | 303 | 3013 | a |
30 __today__ 00:00:00.000 | 304 | 3014 | a |
31 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 __today__ 00:00:00.000 | 301 | 3011 | a |
35 __today__ 00:00:00.000 | 302 | 3012 | a |
36 __today__ 00:00:00.000 | 303 | 3013 | a |
37 __today__ 00:00:00.000 | 304 | 3014 | a |
38 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
42 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
43 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
44 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 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 __today__ 00:00:00.000 |
56 __today__ 00:00:00.000 |
57 __today__ 00:00:00.000 |
58 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
63 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
64 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
65 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
70 __today__ 00:00:00.000 | 101 | 1011 |
71 __today__ 00:00:00.000 | 101 | 1011 |
72 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
77 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
78 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
79 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
91 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
92 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
93 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
98 __today__ 00:00:01.000 | 102 | 1012 |
99 __tomorrow__ 00:00:00.000 | 103 | 1013 |
100 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
105 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
106 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
107 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
108 taos> select b.ts1,a.ts from a1 a join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
109 ts1 | ts |
110 ====================================================
111 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
112 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
113 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
114 __today__ 00:00:00.000 | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
119 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
120 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
121 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
126 __today__ 00:00:01.000 | 102 | 1012 |
127 __tomorrow__ 00:00:00.000 | 103 | 1013 |
128 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
133 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
134 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
135 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
136 taos> select b.c from a1 a 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 __today__ 00:00:00.000 |
147 __today__ 00:00:01.000 |
148 __tomorrow__ 00:00:00.000 |
149 __tomorrow__ 00:00:02.000 |
150 taos> select * from a1 a 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 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 __today__ 00:00:00.000 |
198 __today__ 00:00:01.000 |
199 __tomorrow__ 00:00:00.000 |
200 __tomorrow__ 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 __today__ 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 __today__ 00:00:00.000 |
209 __today__ 00:00:01.000 |
210 __tomorrow__ 00:00:00.000 |
211 __tomorrow__ 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 __today__ 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 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
223 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
224 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
225 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
226 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
227 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
228 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
229 __today__ 00:00:00.000 | 201 | 2 | __today__ 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 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
234 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
235 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
236 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
237 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
238 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
239 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
240 __today__ 00:00:00.000 | 201 | 2 | __today__ 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 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 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 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
250 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
251 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
252 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
257 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
258 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
259 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
264 __today__ 00:00:00.000 | 101 | 1011 |
265 __today__ 00:00:00.000 | 101 | 1011 |
266 __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a |
271 __today__ 00:00:00.000 | 302 | 3012 | a |
272 __today__ 00:00:00.000 | 303 | 3013 | a |
273 __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a |
278 __today__ 00:00:00.000 | 302 | 3012 | a |
279 __today__ 00:00:00.000 | 303 | 3013 | a |
280 __today__ 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 __today__ 00:00:00.000 |
292 __today__ 00:00:00.000 |
293 __today__ 00:00:00.000 |
294 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
299 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
300 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
301 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
306 __today__ 00:00:00.000 | 101 | 1011 |
307 __today__ 00:00:00.000 | 101 | 1011 |
308 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
313 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
314 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
315 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
327 __today__ 00:00:00.000 |
328 __today__ 00:00:00.000 |
329 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
334 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
335 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
336 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
341 __today__ 00:00:01.000 | 102 | 1012 |
342 __tomorrow__ 00:00:00.000 | 103 | 1013 |
343 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
348 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
349 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
350 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
362 __today__ 00:00:01.000 |
363 __tomorrow__ 00:00:00.000 |
364 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
411 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
412 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
413 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
414 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
415 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
416 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
417 __today__ 00:00:00.000 | 404 | 2 | __today__ 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 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
422 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
423 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
424 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
425 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
426 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
427 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
428 __today__ 00:00:00.000 | 404 | 2 | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
434 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
435 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
436 __today__ 00:00:00.000 | 101 | 1011 | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
441 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
442 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
443 __today__ 00:00:00.000 | 101 | 1011 | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
448 __today__ 00:00:00.000 | 101 | 1011 |
449 __today__ 00:00:00.000 | 101 | 1011 |
450 __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a |
455 __today__ 00:00:00.000 | 302 | 3012 | a |
456 __today__ 00:00:00.000 | 303 | 3013 | a |
457 __today__ 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 __today__ 00:00:00.000 |
469 __today__ 00:00:00.000 |
470 __today__ 00:00:00.000 |
471 __today__ 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 __today__ 00:00:00.000 |
476 __today__ 00:00:00.000 |
477 __today__ 00:00:00.000 |
478 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
483 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
484 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
485 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
490 __today__ 00:00:00.000 | 101 | 1011 |
491 __today__ 00:00:00.000 | 101 | 1011 |
492 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
497 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
498 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
499 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
511 __today__ 00:00:00.000 |
512 __today__ 00:00:00.000 |
513 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
518 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
519 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
520 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
525 __today__ 00:00:01.000 | 102 | 1012 |
526 __tomorrow__ 00:00:00.000 | 103 | 1013 |
527 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
532 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
533 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
534 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
546 __today__ 00:00:01.000 |
547 __tomorrow__ 00:00:00.000 |
548 __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 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 __today__ 00:00:00.000 |
597 __today__ 00:00:01.000 |
598 __tomorrow__ 00:00:00.000 |
599 __tomorrow__ 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 __today__ 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 __today__ 00:00:00.000 |
608 __today__ 00:00:01.000 |
609 __tomorrow__ 00:00:00.000 |
610 __tomorrow__ 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 __today__ 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 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
621 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
622 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
623 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
624 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
625 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
626 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
627 __today__ 00:00:00.000 | 201 | 2 | __today__ 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 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
632 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
633 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
634 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
635 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
636 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
637 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
638 __today__ 00:00:00.000 | 201 | 2 | __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
644 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
645 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
646 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
651 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
652 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
653 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
658 __today__ 00:00:00.000 | 101 | 1011 |
659 __today__ 00:00:00.000 | 101 | 1011 |
660 __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a |
665 __today__ 00:00:00.000 | 302 | 3012 | a |
666 __today__ 00:00:00.000 | 303 | 3013 | a |
667 __today__ 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 __today__ 00:00:00.000 |
679 __today__ 00:00:00.000 |
680 __today__ 00:00:00.000 |
681 __today__ 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 __today__ 00:00:00.000 |
686 __today__ 00:00:00.000 |
687 __today__ 00:00:00.000 |
688 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
693 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
694 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
695 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
700 __today__ 00:00:00.000 | 101 | 1011 |
701 __today__ 00:00:00.000 | 101 | 1011 |
702 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
707 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
708 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
709 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
721 __today__ 00:00:00.000 |
722 __today__ 00:00:00.000 |
723 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
728 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
729 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
730 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
735 __today__ 00:00:01.000 | 102 | 1012 |
736 __tomorrow__ 00:00:00.000 | 103 | 1013 |
737 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
742 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
743 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
744 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
756 __today__ 00:00:01.000 |
757 __tomorrow__ 00:00:00.000 |
758 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
805 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
806 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
807 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
808 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
809 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
810 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
811 __today__ 00:00:00.000 | 404 | 2 | __today__ 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 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
816 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
817 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
818 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
819 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
820 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
821 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
822 __today__ 00:00:00.000 | 404 | 2 | __today__ 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,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' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
taos> select * from a1 a join (select today() as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
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 |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select today() as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
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' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select a.*, b.ts from a1 a join (select today() as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts |
================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
__today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:02.000 |
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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from a1 a join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
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 |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
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 |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a join (select today() as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
ts1 | ts |
====================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
__today__ 00:00:00.000 | __today__ 00:00:00.000 |
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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select today() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select today() as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a join (select today() as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
==========================
__today__ 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a join (select today() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today() where tb.ts=today() order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta 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 |
============================================================================================================
__tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
taos> select * from (select today() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select * from (select today() as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today() as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.* from (select today() as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select today() as ts, f, g, 'a' c from b1) b 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select today() as ts1, ts, f, g, 'a' c from b1) b 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select today() as ts1, ts, f, g, 'a' c from b1) b 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select 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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select 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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today() where tb.ts=today() order by tb.val;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb 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' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
taos> select * from a1 a , (select today() as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
ts | f | g | ts1 | f | g | 'a' |
==================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today() as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select today() as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select b.ts1 from a1 a , (select today() as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from a1 a , (select today() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select today() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from a1 a , (select today() as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select today() as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a , (select today() as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from a1 a , (select 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select today() as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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' |
============================================================================================================================================
__today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select today() as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
==========================
__today__ 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select b.ts from (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select b.ts from (select today() as ts1, ts, f, g, 'a' c from a1 order by f) a , (select today() as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
__today__ 00:00:00.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select 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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select 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 |
============================================================================================================
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
__today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
__today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select 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 |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select * from (select today() as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
==================================================================================================================
__today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today() as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today() as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' |
============================================================
__today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | 304 | 3014 | a |
taos> select b.c from (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select b.ts1 from (select today() as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
ts1 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select 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 |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
__today__ 00:00:00.000 |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select today() as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
__today__ 00:00:00.000 | 101 | 1011 |
__today__ 00:00:01.000 | 102 | 1012 |
__tomorrow__ 00:00:00.000 | 103 | 1013 |
__tomorrow__ 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select today() as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
======================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
__today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
__today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select 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 |
==========================
__today__ 00:00:00.000 |
__today__ 00:00:01.000 |
__tomorrow__ 00:00:00.000 |
__tomorrow__ 00:00:02.000 |
taos> select * from (select today() as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select 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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
============================================================================================================================================
__today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select 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 |
======================================================
__today__ 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' |
======================================================================================
__today__ 00:00:00.000 | __today__ 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 |
==========================
__today__ 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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (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 |
============================================================================================================
__today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
__today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
__today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
taos> select * from (select today() ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
7 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
8 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
9 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
10 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
14 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
15 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
16 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
17 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 __today__ 00:00:00.000 | 101 | 1011 |
21 __today__ 00:00:00.000 | 101 | 1011 |
22 __today__ 00:00:00.000 | 101 | 1011 |
23 __today__ 00:00:00.000 | 101 | 1011 |
24 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 __today__ 00:00:00.000 | 301 | 3011 | a |
28 __today__ 00:00:00.000 | 302 | 3012 | a |
29 __today__ 00:00:00.000 | 303 | 3013 | a |
30 __today__ 00:00:00.000 | 304 | 3014 | a |
31 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 __today__ 00:00:00.000 | 301 | 3011 | a |
35 __today__ 00:00:00.000 | 302 | 3012 | a |
36 __today__ 00:00:00.000 | 303 | 3013 | a |
37 __today__ 00:00:00.000 | 304 | 3014 | a |
38 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
42 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
43 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
44 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 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 __today__ 00:00:00.000 |
56 __today__ 00:00:00.000 |
57 __today__ 00:00:00.000 |
58 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
63 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
64 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
65 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
70 __today__ 00:00:00.000 | 101 | 1011 |
71 __today__ 00:00:00.000 | 101 | 1011 |
72 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
77 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
78 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
79 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
91 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
92 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
93 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
98 __today__ 00:00:01.000 | 102 | 1012 |
99 __tomorrow__ 00:00:00.000 | 103 | 1013 |
100 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
105 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
106 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
107 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
108 taos> select b.ts1,a.ts from a1 a join (select today() as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
109 ts1 | ts |
110 ====================================================
111 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
112 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
113 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
114 __today__ 00:00:00.000 | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
119 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
120 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
121 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
126 __today__ 00:00:01.000 | 102 | 1012 |
127 __tomorrow__ 00:00:00.000 | 103 | 1013 |
128 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
133 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
134 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
135 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
136 taos> select b.c from a1 a 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 __today__ 00:00:00.000 |
147 __today__ 00:00:01.000 |
148 __tomorrow__ 00:00:00.000 |
149 __tomorrow__ 00:00:02.000 |
150 taos> select * from a1 a 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 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 __today__ 00:00:00.000 |
198 __today__ 00:00:01.000 |
199 __tomorrow__ 00:00:00.000 |
200 __tomorrow__ 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 __today__ 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 __today__ 00:00:00.000 |
209 __today__ 00:00:01.000 |
210 __tomorrow__ 00:00:00.000 |
211 __tomorrow__ 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 __today__ 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 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
223 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
224 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
225 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
226 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
227 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
228 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
229 __today__ 00:00:00.000 | 201 | 2 | __today__ 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 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
234 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
235 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
236 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
237 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
238 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
239 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
240 __today__ 00:00:00.000 | 201 | 2 | __today__ 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 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 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 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
250 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
251 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
252 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
257 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
258 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
259 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
264 __today__ 00:00:00.000 | 101 | 1011 |
265 __today__ 00:00:00.000 | 101 | 1011 |
266 __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a |
271 __today__ 00:00:00.000 | 302 | 3012 | a |
272 __today__ 00:00:00.000 | 303 | 3013 | a |
273 __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a |
278 __today__ 00:00:00.000 | 302 | 3012 | a |
279 __today__ 00:00:00.000 | 303 | 3013 | a |
280 __today__ 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 __today__ 00:00:00.000 |
292 __today__ 00:00:00.000 |
293 __today__ 00:00:00.000 |
294 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
299 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
300 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
301 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
306 __today__ 00:00:00.000 | 101 | 1011 |
307 __today__ 00:00:00.000 | 101 | 1011 |
308 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
313 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
314 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
315 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
327 __today__ 00:00:00.000 |
328 __today__ 00:00:00.000 |
329 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
334 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
335 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
336 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
341 __today__ 00:00:01.000 | 102 | 1012 |
342 __tomorrow__ 00:00:00.000 | 103 | 1013 |
343 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
348 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
349 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
350 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
362 __today__ 00:00:01.000 |
363 __tomorrow__ 00:00:00.000 |
364 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
411 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
412 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
413 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
414 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
415 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
416 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
417 __today__ 00:00:00.000 | 404 | 2 | __today__ 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 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
422 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
423 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
424 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
425 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
426 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
427 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
428 __today__ 00:00:00.000 | 404 | 2 | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
434 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
435 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
436 __today__ 00:00:00.000 | 101 | 1011 | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
441 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
442 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
443 __today__ 00:00:00.000 | 101 | 1011 | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
448 __today__ 00:00:00.000 | 101 | 1011 |
449 __today__ 00:00:00.000 | 101 | 1011 |
450 __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a |
455 __today__ 00:00:00.000 | 302 | 3012 | a |
456 __today__ 00:00:00.000 | 303 | 3013 | a |
457 __today__ 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 __today__ 00:00:00.000 |
469 __today__ 00:00:00.000 |
470 __today__ 00:00:00.000 |
471 __today__ 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 __today__ 00:00:00.000 |
476 __today__ 00:00:00.000 |
477 __today__ 00:00:00.000 |
478 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
483 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
484 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
485 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
490 __today__ 00:00:00.000 | 101 | 1011 |
491 __today__ 00:00:00.000 | 101 | 1011 |
492 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
497 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
498 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
499 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
511 __today__ 00:00:00.000 |
512 __today__ 00:00:00.000 |
513 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
518 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
519 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
520 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
525 __today__ 00:00:01.000 | 102 | 1012 |
526 __tomorrow__ 00:00:00.000 | 103 | 1013 |
527 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
532 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
533 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
534 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
546 __today__ 00:00:01.000 |
547 __tomorrow__ 00:00:00.000 |
548 __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 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 __today__ 00:00:00.000 |
597 __today__ 00:00:01.000 |
598 __tomorrow__ 00:00:00.000 |
599 __tomorrow__ 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 __today__ 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 __today__ 00:00:00.000 |
608 __today__ 00:00:01.000 |
609 __tomorrow__ 00:00:00.000 |
610 __tomorrow__ 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 __today__ 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 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
621 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
622 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
623 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
624 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
625 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
626 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
627 __today__ 00:00:00.000 | 201 | 2 | __today__ 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 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
632 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
633 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
634 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
635 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
636 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
637 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
638 __today__ 00:00:00.000 | 201 | 2 | __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
644 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
645 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
646 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
651 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
652 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
653 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
658 __today__ 00:00:00.000 | 101 | 1011 |
659 __today__ 00:00:00.000 | 101 | 1011 |
660 __today__ 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 __today__ 00:00:00.000 | 301 | 3011 | a |
665 __today__ 00:00:00.000 | 302 | 3012 | a |
666 __today__ 00:00:00.000 | 303 | 3013 | a |
667 __today__ 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 __today__ 00:00:00.000 |
679 __today__ 00:00:00.000 |
680 __today__ 00:00:00.000 |
681 __today__ 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 __today__ 00:00:00.000 |
686 __today__ 00:00:00.000 |
687 __today__ 00:00:00.000 |
688 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
693 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
694 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
695 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 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 __today__ 00:00:00.000 | 101 | 1011 |
700 __today__ 00:00:00.000 | 101 | 1011 |
701 __today__ 00:00:00.000 | 101 | 1011 |
702 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
707 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
708 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
709 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
721 __today__ 00:00:00.000 |
722 __today__ 00:00:00.000 |
723 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
728 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
729 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
730 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 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 __today__ 00:00:00.000 | 101 | 1011 |
735 __today__ 00:00:01.000 | 102 | 1012 |
736 __tomorrow__ 00:00:00.000 | 103 | 1013 |
737 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
742 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
743 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
744 __today__ 00:00:00.000 | __tomorrow__ 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 __today__ 00:00:00.000 |
756 __today__ 00:00:01.000 |
757 __tomorrow__ 00:00:00.000 |
758 __tomorrow__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 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 __today__ 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 __today__ 00:00:00.000 | __today__ 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 __today__ 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 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
805 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
806 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
807 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
808 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
809 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
810 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
811 __today__ 00:00:00.000 | 404 | 2 | __today__ 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 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
816 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
817 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
818 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
819 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
820 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
821 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
822 __today__ 00:00:00.000 | 404 | 2 | __today__ 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,811 @@
taos> use test;
Database changed.
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b on a.ts = b.ts;
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
taos> select a.*, b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
ts | f | g | ts |
================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:01.000 |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:00.000 |
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-05 00:00:02.000 |
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g | ts1 | ts | f | g | c |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
ts1 | ts | f | g | c |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.ts1,a.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g | ts1 | ts | f | g | 'a' |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a join (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" where tb.ts="2025-03-04 00:00:00.000" order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta join (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" where tb.ts>"2025-03-04 00:00:00.000";
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta join (select today() + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
ts | val | tg2 | ts | val | tg2 |
============================================================================================================
2025-03-05 00:00:03.000 | 204 | 2 | 2025-03-05 00:00:03.000 | 404 | 2 |
taos> select * from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
====================================================================================================================
| 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
====================================================================================================================
| 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g | 'a' |
==============================================================
| 301 | 3011 | a |
| 302 | 3012 | a |
| 303 | 3013 | a |
| 304 | 3014 | a |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b join a1 a on a.ts = b.ts1;
ts1 | f | g | 'a' |
==============================================================
| 301 | 3011 | a |
| 302 | 3012 | a |
| 303 | 3013 | a |
| 304 | 3014 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
============================
|
|
|
|
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
==============================================================================================================================================
| 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
| 2025-03-04 00:00:00.000 | 301 | 3011 | a |
| 2025-03-04 00:00:01.000 | 302 | 3012 | a |
| 2025-03-05 00:00:00.000 | 303 | 3013 | a |
| 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts;
ts1 |
============================
|
|
|
|
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on a.ts = b.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b join a1 a on b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;;
ts | val | tg2 | ts | val | tg2 |
==============================================================================================================
| 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" where tb.ts="2025-03-04 00:00:00.000" order by tb.val;
ts | val | tg2 | ts | val | tg2 |
==============================================================================================================
| 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" where tb.ts>"2025-03-04 00:00:00.000";
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b where a.ts = b.ts1;
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b where a.ts = b.ts;
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b where a.ts = b.ts;
taos> select b.ts1 from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b where a.ts = b.ts1;
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts;
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from a1 a , (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b where b.ts1 = a.ts;
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:01.000 | 102 | 1012 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-05 00:00:00.000 | 103 | 1013 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-05 00:00:02.000 | 104 | 1014 | 2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g | ts1 | ts | f | g | 'a' |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g | ts1 | ts | f | g | 'a' |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 101 | 1011 | 2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select a.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from a1 a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts1 = a.ts1 and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from a1 order by f) a , (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" order by tb.val;
taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta , (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" ;
taos> select * from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' | ts | f | g |
====================================================================================================================
| 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' from b1) b , a1 a where a.ts = b.ts1;
ts1 | f | g | 'a' | ts | f | g |
====================================================================================================================
| 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g | 'a' |
==============================================================
| 301 | 3011 | a |
| 302 | 3012 | a |
| 303 | 3013 | a |
| 304 | 3014 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
============================
|
|
|
|
taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts1;
ts1 |
============================
|
|
|
|
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
==============================================================================================================================================
| 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
| 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
| 2025-03-04 00:00:00.000 | 301 | 3011 | a |
| 2025-03-04 00:00:01.000 | 302 | 3012 | a |
| 2025-03-05 00:00:00.000 | 303 | 3013 | a |
| 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts1 from (select "2025-03-04 00:00:00.000" as ts1, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts;
ts1 |
============================
|
|
|
|
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a | 2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a | 2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a | 2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
2025-03-04 00:00:01.000 | 102 | 1012 |
2025-03-05 00:00:00.000 | 103 | 1013 |
2025-03-05 00:00:02.000 | 104 | 1014 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where a.ts = b.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
2025-03-04 00:00:00.000 | 2025-03-04 00:00:01.000 | 302 | 3012 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:00.000 | 303 | 3013 | a |
2025-03-04 00:00:00.000 | 2025-03-05 00:00:02.000 | 304 | 3014 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
c |
======
a |
a |
a |
a |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
2025-03-04 00:00:01.000 |
2025-03-05 00:00:00.000 |
2025-03-05 00:00:02.000 |
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' | ts | f | g |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
c |
======
a |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts1 = a.ts and a.ts = b.ts;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' | ts | f | g |
==============================================================================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a | 2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select a.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts | f | g |
======================================================
2025-03-04 00:00:00.000 | 101 | 1011 |
taos> select b.* from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts1 | ts | f | g | 'a' |
========================================================================================
2025-03-04 00:00:00.000 | 2025-03-04 00:00:00.000 | 301 | 3011 | a |
taos> select b.c from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
c |
======
a |
taos> select b.ts from (select "2025-03-04 00:00:00.000" as ts1, ts, f, g, 'a' c from b1) b , a1 a where b.ts = a.ts and a.ts = b.ts1;
ts |
==========================
2025-03-04 00:00:00.000 |
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta where ta.ts=tb.ts and ta.tg1=tb.tg1;
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2;
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 order by tb.val;
ts | val | tg2 | ts | val | tg2 |
==============================================================================================================
| 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts="2025-03-04 00:00:00.000" order by tb.val;
ts | val | tg2 | ts | val | tg2 |
==============================================================================================================
| 301 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 302 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 303 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 304 | 1 | 2025-03-04 00:00:00.000 | 101 | 1 |
| 401 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 402 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 403 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
| 404 | 2 | 2025-03-04 00:00:00.000 | 201 | 2 |
taos> select * from (select "2025-03-04 00:00:00.000" ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb , (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta where ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>"2025-03-04 00:00:00.000" ;
Can't render this file because it contains an unexpected character in line 5 and column 39.

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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