VistaDB 5
LEFT JOIN

Returns all the rows on the left table even if there are no matching rows in the right table.

Example

Compound JOIN clauses are possible as well.  Joining the same lookup ID from table1 into table2 and table3.  Note the columns to be joined do NOT
have to be part of the SELECT portion of the statement. They are shown above just for clarity.

Compound Join Example
Copy Code
SELECT table1.col1, table2.col2, table3.col3 
FROM table1 
    LEFT JOIN table2 ON table1.col1 = table2.col2 
    LEFT JOIN table3 ON table1.col1 = table3.col3


SELECT table1.firstname, table2.Title 
FROM table1 
    LEFT JOIN table2 ON table1.ID = table2.ID

Performance Considerations

A key consideration as a part of the JOIN syntax is the indexes on the tables that are being joined. If you are joining two tables based upon an ID make sure that both tables have an index on that column for fastest operation.

We do not recommend you perform joins on columns that are purely text data. The engine must compare strings repeatedly in order to validate they are the same and that operation is quite slow. An integer or biginteger are the fastest column types to join. GUIDS require multiple compare operations in .Net as well, so they are slower than native integer or long compares.

See Also