diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index 4dd0327a82df45afdfd986c06527caaf76cac73f..e9e32bca785027080306f99c7491718547618aaf 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -9775,6 +9775,9 @@ static int32_t doValidateSubquery(SSqlNode* pSqlNode, int32_t index, SSqlObj* pS tstrncpy(pTableMetaInfo1->aliasName, subInfo->aliasName.z, subInfo->aliasName.n + 1); } + if (TPARSER_HAS_TOKEN(pSqlNode->interval.interval) && pSub->order.orderColId == INT32_MIN) { + pSub->order.orderColId = PRIMARYKEY_TIMESTAMP_COL_INDEX; + } // NOTE: order mix up in subquery not support yet. pQueryInfo->order = pSub->order;