Code

Dim target As SelectQuery = New SelectQuery()
target.Fields.Add("Table1.FieldC")
target.Fields.Add("Table2.FieldD")
target.TableName = "Table1"
    
target.AddCriteria("Table1.FieldE", Operation.EqualTo, "1")
    
Dim Join As New JoinInfo
Join.Table = "Table2"
Join.JoinType = JoinType.Inner
Join.AddCriteria(New Criteria("Table1.FieldA", Operation.EqualTo, "Table2.FieldB") With {.RightExpressionType = ExpressionType.Field})
    
target.Join.Add(Join)
console.writeline(target.GetQueryText)

Output

SELECT Table1.FieldC, Table2.FieldD FROM Table1 INNER JOIN Table2 ON Table1.FieldA = Table2.FieldB WHERE Table1.FieldE = 1

Last edited Nov 21, 2011 at 4:48 AM by BradleyUffner, version 5

Comments

No comments yet.