diff --git a/src/alias.ts b/src/alias.ts index c66da53..e588614 100644 --- a/src/alias.ts +++ b/src/alias.ts @@ -42,6 +42,9 @@ export class TableAlias { this.dbLangTableAttributes[a.name] = attrAlias; } } + serializeAlias(hander: Handler) { + return this.dbLangTableInstance.serialize(hander) + " " + this.toString(hander); + } serialize(handler: Handler) { return this.toString(handler); } diff --git a/src/defaultHandler.ts b/src/defaultHandler.ts index 510da7e..81398e1 100644 --- a/src/defaultHandler.ts +++ b/src/defaultHandler.ts @@ -241,8 +241,10 @@ export class Handler { builder.addCode(` from `); if (q.from == null) { builder.addCode(" DUAL"); - } else if (q.from instanceof Table || q.from instanceof TableAlias) { + } else if (q.from instanceof Table) { builder.addCode(q.from.serialize(handler)); + } else if (q.from instanceof TableAlias) { + builder.addCode(q.from.serializeAlias(handler)); } else { builder.append(q.from.serialize(handler)); }