There are two ways to do a join. You can use a JOIN or a WHERE syntax. WHERE joins were the only way to do a join until SQL-92 introduced the JOIN syntax. As a result, you will find both forms in use.
JOIN syntax format: Example:
SELECT select_columns SELECT V.VNDR_ID,
FROM table1 join_type table2 V.VENDOR_NAME,
ON join_condition I.DESCRIPTION
[WHERE search_condition] FROM VENDOR_TBL V
[GROUP BY grouping_columns] INNER JOIN INVENTORY_TBL I
[HAVING search_condition] ON V.VNDR_ID = I.VNDR_ID;
[ORDER BY sort_columns];
Select_columns is one or more selected columns, separated by a comma, from table1 and table2.
Join_type is the type of join to be performed, such as INNER JOIN, LEFT OUTER JOIN, RIGHT OUTER JOIN, FULL OUTER JOIN, NATURAL JOIN, and CROSS JOIN.
ON is not allowed for CROSS JOIN or NATURAL JOIN.
Join_condition shows the conditions for one or more joined rows.
The format is [table1.]column oper [table2.]column where oper is =, <, <=, >, >=, <>, AND, OR, or NOT.
The WHERE, GROUP BY, HAVING, and ORDER BY have been discussed in previous topics.
> WHERE syntax joins can only be done with AND. WHERE syntax joins using OR are not legal.