diff --git a/src/client/src/tscServer.c b/src/client/src/tscServer.c index 67c7d2b1e8d112f98a66fb72b61d82c41ee11fe5..e42f73fb327b7a0c85741fd1edbcdc21845c5488 100644 --- a/src/client/src/tscServer.c +++ b/src/client/src/tscServer.c @@ -1964,6 +1964,11 @@ int tscProcessRetrieveGlobalMergeRsp(SSqlObj *pSql) { // global aggregation may be the upstream for parent query SQueryInfo *pQueryInfo = tscGetQueryInfo(pCmd); + if (tscOrderedProjectionQueryOnSTable(pQueryInfo, 0)) { + pQueryInfo->limit.limit = pQueryInfo->clauseLimit; + pQueryInfo->limit.offset = pQueryInfo->prjOffset; + } + if (pQueryInfo->pQInfo == NULL) { STableGroupInfo tableGroupInfo = {.numOfTables = 1, .pGroupList = taosArrayInit(1, POINTER_BYTES),};