Extend table join conditions to include expressions #7

hisystems opened this Issue Mar 4, 2012 · 0 comments


None yet

1 participant


Currently, table joins only support simple field comparison conditions such as:

SELECT * FROM Table1 INNER JOIN Table2 ON Table1.KeyField = Table2.KeyField

It needs to support more complicated conditions as per the SQLConditions class. For example:

SELECT * FROM Table1 INNER JOIN Table2 ON Table1.KeyField = Table2.KeyField AND Table1.Name <> ''
@hisystems hisystems was assigned Mar 4, 2012
@hisystems hisystems added a commit that closed this issue Mar 4, 2012
@hisystems Improved creating multiple table joins. Closes #6. Closes #7.
Creating a single table join remains the same, there is no breaking change to the API. However, creating two or more table joins is now more intuitive. The return value from 'table1AndTable2 = sqlSelect.Tables.Joins.Add(table1, Type.Inner, table2)' can then be used in subsequent table join calls i.e. 'sqlSelect.Tables.Joins.Add(table1AndTable2 , Type.Inner, table3)'. This indicates that the table1AndTable2 join created in the first step is then joined to table3.

Also changed the SQLSelectTableJoinCondition to accept SQLExpression objects rather than the left and right table field names. This was required because now that the left table for a join can be either a table or a joined table the left field table alias may be unknown if it is an table join. In which case the table alias must come from an SQLFieldExpression (inherits SQLExpression) which will indicate the table alias. The way it was working where it would obtain the table name from the join was incorrect. So also closing issue #7.
@hisystems hisystems closed this in 6f65497 Mar 4, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment