473,761 Members | 3,542 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1831
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
2514
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 more than one instance of this application listening to the input request.How sholuld create multiple instance
4
1884
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 whole apply process, sometime not, and seems like only those two SPs met the problem. No error was appeared. Did anyone meet same problem before? Or any possible solutions? Thank you very much!
0
1431
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: http://www.3leaf.com/default/articles/ea/SBS.aspx The application settings form they show is not what I see in my Windows Forms application when using VS 2003. I don't see an option anywhere in the application properties form to specify the versions of the framework the...
2
1313
by: sudhirlko2001 | last post by:
Can anybody explain me the side effects of Mutiple inheritance in C++; ~Sudhir
0
1469
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 after clicking button1, and similray remvoing the mutiple selected ite,s from, another after clicking button2 ,, how can i do this ,, my script is given belo...
0
1566
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
1898
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 other columns in the row... Could someone help me with this . Below is the complete script...and form.. <?php if(isset($_POST) && $_FILES && $_FILES && $_FILES && $_FILES && $_FILES && $_FILES && $_FILES > 0) { $fileName = $_FILES; $tmpName =...
7
1709
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; $norow=mysql_num_rows($res);
2
2968
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 disable a button control....plz tell me what event gets fired if a user selects multiple cells or columns or rows..so tht i can write code to disable a button....plz reply back soon...thks for any assistance...
6
2171
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 user specified name. can anybody guide me no this? thanks.
0
9554
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9377
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9989
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9925
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7358
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6640
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5266
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3913
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.