From b4fd978cae0b69328fedb8931bc608371f4b6fef Mon Sep 17 00:00:00 2001 From: u Date: Thu, 9 Feb 2023 14:02:49 +0800 Subject: [PATCH] 'fix' --- types.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/types.go b/types.go index ad8c7d9..3032715 100644 --- a/types.go +++ b/types.go @@ -485,11 +485,13 @@ func (q *Query) FromSelect(selectStmt *sqlparser.Select) error { switch right := form.RightExpr.(type) { case *sqlparser.AliasedTableExpr: + join.Query = &Query{} if right.As.String() != "" { - join.Query = &Query{From: From{As: right.As.String()}} + join.Query.From.As = right.As.String() } switch rightExpr := right.Expr.(type) { case sqlparser.TableName: + log.Println("rightExpr:", jsonEncode(rightExpr)) join.Query.From.Table = string(rightExpr.Name.String()) case *sqlparser.Subquery: subQuery := &Query{}