我需要一种想法,将以下“如果是”条件转变为原始声明。 (无动态)
Dim strVar1 as String, strVar2 as String, strVar3 as String, intSet Int32
.Append("SELECT * FROM TABLE_A as A ")
.Append("INNER JOIN TABLE_B as B ON A.Code=B.Code_A ")
If strVar1.Length > 0 Then
.Append("LEFT JOIN TABLE_C as C ON C.Code=A.Code_C ")
.Append("LEFT OUTER JOIN TABLE_D as D on C.Code=D.Code_C AND D.Col1 IN (1,NULL) ")
End If
If strVar2.Length > 0 Or strVar3.Length > 0 Then
.Append("LEFT OUTER JOIN TABLE_E as E ON A.Code=E.Code_A ")
.Append("LEFT OUTER JOIN TABLE_F as F ON E.Col1=F.Col1 ")
.Append("INNER JOIN TABLE_G ON as G ON F.Code=G.Code_F AND G.Col1=1 ")
End If
Select Case intType
Case 1 , 2
If intSet <> -1 Then
.Append("LEFT OUTER JOIN TABLE_H H on A.code=H.code_A AND H.code_H=1 AND H.Pos=1 ")
Else
.Append("LEFT OUTER JOIN TABLE_H H on A.code=H.code_A AND H.Pos=1 ")
End If
Case 3 , 4
End Select