diff --git a/dist/package-shared/functions/dsql/sql/sql-generator.js b/dist/package-shared/functions/dsql/sql/sql-generator.js index 465f913..74615e7 100644 --- a/dist/package-shared/functions/dsql/sql/sql-generator.js +++ b/dist/package-shared/functions/dsql/sql/sql-generator.js @@ -142,12 +142,13 @@ function sqlGenerator({ tableName, genObject, dbFullName, count }) { let countSqls = []; for (let i = 0; i < genObject.countSubQueries.length; i++) { const countSubQuery = genObject.countSubQueries[i]; + const tableAlias = countSubQuery.table_alias; let subQStr = `(SELECT COUNT(*)`; - subQStr += ` FROM ${countSubQuery.table}`; + subQStr += ` FROM ${countSubQuery.table}${tableAlias ? ` ${tableAlias}` : ""}`; subQStr += ` WHERE (`; for (let j = 0; j < countSubQuery.srcTrgMap.length; j++) { const csqSrc = countSubQuery.srcTrgMap[j]; - subQStr += ` ${countSubQuery.table}.${csqSrc.src}`; + subQStr += ` ${tableAlias || countSubQuery.table}.${csqSrc.src}`; if (typeof csqSrc.trg == "string") { subQStr += ` = ?`; sqlSearhValues.push(csqSrc.trg); diff --git a/dist/package-shared/types/index.d.ts b/dist/package-shared/types/index.d.ts index 2cb34a7..17a749b 100644 --- a/dist/package-shared/types/index.d.ts +++ b/dist/package-shared/types/index.d.ts @@ -846,6 +846,8 @@ export type ServerQueryParamFullTextSearch