Skip to content

Commit c00534e

Browse files
committed
- 修复 WithTempQuery+AsTreeCte 生成SQL错误;#2080
1 parent 5e4bcfd commit c00534e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

FreeSql/Extensions/FreeSqlGlobalExtensions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@ WHERE @cte_ids IS NOT NULL
893893
select._where.Clear();
894894
select.As("wct2");
895895
var sql2Field = select.GetAllFieldExpressionTreeLevel2(false).Field;
896+
if (sql2Field == "*") sql2Field = "wct2.*";
896897
var sql2InnerJoinOn = up == false ?
897898
string.Join(" and ", tbref.Columns.Select((a, z) => $"wct2.{select._commonUtils.QuoteSqlName(tbref.RefColumns[z].Attribute.Name)} = wct1.{select._commonUtils.QuoteSqlName(a.Attribute.Name)}")) :
898899
string.Join(" and ", tbref.Columns.Select((a, z) => $"wct2.{select._commonUtils.QuoteSqlName(a.Attribute.Name)} = wct1.{select._commonUtils.QuoteSqlName(tbref.RefColumns[z].Attribute.Name)}"));

0 commit comments

Comments
 (0)