diff --git a/src/client/src/tscSQLParser.c b/src/client/src/tscSQLParser.c index bb31b752a1bd5856f45dde901c6c589c92063279..193676cd93303f035cda24a2d944e85fbff91ee1 100644 --- a/src/client/src/tscSQLParser.c +++ b/src/client/src/tscSQLParser.c @@ -8481,7 +8481,15 @@ static bool check_expr_in_groupby_colum(SGroupbyExpr* pGroupbyExpr, SExprInfo* p return false; for (int32_t k = 0; k < pGroupbyExpr->numOfGroupCols ; ++k) { pIndex = taosArrayGet(pGroupbyExpr->columnInfo, k); - if (!strcmp(pIndex->name,&pExpr->base.colInfo.name[1])){ // notes:first char is dot, skip one char. + + // find last dot + char * name = strrchr(pExpr->base.colInfo.name, '.'); + if(name) + name += 1; + else + name = pExpr->base.colInfo.name; + + if (!strcmp(pIndex->name, name)){ return true; } }