use alias 'as.*' in oracle query with join (#1355)

This commit is contained in:
Cheng Lu 2019-07-16 09:21:31 +08:00 committed by Lunny Xiao
parent f3e6c3a26b
commit 62d884e8f1
1 changed files with 5 additions and 1 deletions

View File

@ -1157,8 +1157,12 @@ func (statement *Statement) genSelectSQL(columnStr, condSQL string, needLimit, n
if statement.Start != 0 || statement.LimitN != 0 { if statement.Start != 0 || statement.LimitN != 0 {
oldString := buf.String() oldString := buf.String()
buf.Reset() buf.Reset()
rawColStr := columnStr
if rawColStr == "*" {
rawColStr = "at.*"
}
fmt.Fprintf(&buf, "SELECT %v FROM (SELECT %v,ROWNUM RN FROM (%v) at WHERE ROWNUM <= %d) aat WHERE RN > %d", fmt.Fprintf(&buf, "SELECT %v FROM (SELECT %v,ROWNUM RN FROM (%v) at WHERE ROWNUM <= %d) aat WHERE RN > %d",
columnStr, columnStr, oldString, statement.Start+statement.LimitN, statement.Start) columnStr, rawColStr, oldString, statement.Start+statement.LimitN, statement.Start)
} }
} }
} }