diff --git a/_FiveSql2/src/TSqlAgg.prg b/_FiveSql2/src/TSqlAgg.prg index 4b2399f..d6f2992 100644 --- a/_FiveSql2/src/TSqlAgg.prg +++ b/_FiveSql2/src/TSqlAgg.prg @@ -404,6 +404,13 @@ METHOD ComputeAgg( xE, aGR, aFN ) CLASS TSqlAgg ENDIF nCol := ::FindColIdx2( cArgName, aFN ) + /* Also try the QUALIFIED name from the AST (e.g. "o.amount") since + * the Go SqlHashJoin fast path preserves qualifier prefixes in + * aFieldNames for JOIN disambiguation. SqlExprName strips them + * but the hidden column might be stored with the full qualified form. */ + IF nCol == 0 .AND. xArg[ 1 ] == ND_COL .AND. xArg[ 2 ] != cArgName + nCol := ::FindColIdx2( Upper( xArg[ 2 ] ), aFN ) + ENDIF IF nCol == 0 .AND. xArg[ 1 ] == ND_COL IF cFunc == "COUNT" RETURN Len( aGR )