February 4th, 2009

INNER JOIN with Multiple Equates

Posted by admin in L. JOINs

You can use multiple conditions to match tables.

                       JOIN syntax:                                                 WHERE syntax:

          SELECT t1.column1   AS ‘title1′,                   SELECT t1.column1 AS ‘title1′,
                       t2.column2   AS ‘title2′, …                             t2.column2 AS ‘title2′, …
             FROM table1          [AS] ‘t1′                           FROM table1        [AS] ‘t1′,
             INNER JOIN table2 [AS] ‘t2′                                     table2        [AS] ‘t2′
                  ON t1.column1 = t2.column1[,              WHERE t1.column1 = t2.column1[,
          AND|OR t1.column2 = t2.column2];             AND|OR t1.column2 = t2.column2];

> You can do matching on any number of tables and columns.

Comments are closed.

Sorry, the comment form is closed at this time.