Reply to Re: newb - mutiple-column join

Your name:

Reply:


Posted by Plamen Ratchev on 03/23/07 19:20

What you are using here is the old join syntax, which lists that tables to
join in the FROM clause separated by a comma and then the filters are
applied in the WHERE clause. To use this syntax with multiple columns you
just keep adding the pairs of columns to match, like this:

SELECT <column list>
FROM tableA, tableB
WHERE tableA.col1 = tableB.col1
AND tableA.col2 = tableB.col2
... <and so on keep adding more filters if needed>

The newer syntax uses the JOIN keyword, like this:

SELECT <column list>
FROM tableA
INNER JOIN tableB
ON tableA.col1 = tableB.col1
AND tableA.col2 = tableB.col2
... <and so on keep adding more filters if needed>

There are different types of joins: CROSS, INNER, and OUTER (LEFT, RIGHT, or
FULL). Also, there are a couple ANSI joins currently not supported by SQL
Server (natural and union joins).

Here is more information on using joins:
http://msdn2.microsoft.com/en-us/library/ms191472.aspx

HTH,

Plamen Ratchev
http://www.SQLStudio.com

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация