473,398 Members | 2,212 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

newb - mutiple-column join

Hi,

very new to SQL queries, and strugling with join concept

I had to do a join based on a single field:

select
*
from
tableA, tableB
where
tableA.value = tableB.value(+)
;

this works fine

but how can i do the same thing while comparing multiple columns ... i
was thinking something like this: (obviously doesn't work)

select
*
from
tableA, tableB
where
[tableA.value1, tableA.value2] = [tableB.value1,
tableB.value2](+)
;

Is there some sort of "tuple" comparison I can do?

Thank you.

Mar 23 '07 #1
2 1808
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

Mar 23 '07 #2
....and just noted the (+), seems you are using the old Oracle outer join
syntax, which is equivalent to LEFT OUTER JOIN. I believe if you have a
version of Oracle higher than Oracle 8i you can use the new syntax.

Plamen Ratchev
http://www.SQLStudio.com
Mar 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: varadha | last post by:
Hi, My Application listening to a port of my machine and it response with data to the requesting system. This application is provided as a service in my machine. Now i am planning to have...
4
by: topjun | last post by:
using osql to apply SPs in mutiple threads Hello, I got a weird problem when I was using osql to apply scripts for msde database in multiple threads mode. Sometime 2 sps were missing during the...
0
by: Michael Lang | last post by:
I want an application I wrote to work with mutiple versions of the .NET framework. I found the following link helpful on the concepts, but not the execution: ...
2
by: sudhirlko2001 | last post by:
Can anybody explain me the side effects of Mutiple inheritance in C++; ~Sudhir
0
by: deepak | last post by:
i have set multiple selection property in bith listboxes(html control) to true. i have taken 2 buttons(html control) say Button1,Button2.now i want to add mutiple selected items to another listbox...
0
by: saravana | last post by:
I have to display the mutiple xml filename path in treeview control using c#. net some thing like this In treeview control....... ========= =C:\\a.xml=
2
by: underground | last post by:
I need a little help figuring this one out. I have a script that should post mutiple binary files into a single row but instead of copying the indiviuals files it rewrites the first file to all the...
7
by: shanmugamit | last post by:
hi, i using mutiple check box but i didn't get all value... as $res=mysql_query("select * from cie where des='Resource Pipeline Associate' order by name"); $j=0;...
2
by: ravitunk | last post by:
hi..i have a datagridview in my windows application using C#......i want to select mutiple cells(by pressing shift key) or select mutiple columns or multiple rows.....if this happens then i should...
6
by: dewraj | last post by:
Hi I am using windows applicaiton(.net) as front end, and I want to get mutiple tables in Dataset by executing a single stored procedure i.e. SP would return mutiple tables (record sets) with the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.