473,464 Members | 1,516 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Question about SQL joins

Don
I am trying to use SQL to return data from multiple tables at the same time.
My first table is keyed on SSN. This table has an ID field in it. I will
use this ID to find matching rows in 4 other tables. If any or all of the 4
tables do not have matching rows I still want to return a row from the
original table and anywhere a match was found.

I am using Visual Studio to create the stored procedure. From what I have
read the VS default is to create inner joins. Do I need to use a Left join
to acheive my goal?

Don
Jul 21 '05 #1
1 1123
Yes, If you use a left join you will get all the data from the primary table
even if the secondary table do not have related rows.

Brad Shook
"Don" <Do*@discussions.microsoft.com> wrote in message
news:1C**********************************@microsof t.com...
I am trying to use SQL to return data from multiple tables at the same time. My first table is keyed on SSN. This table has an ID field in it. I will
use this ID to find matching rows in 4 other tables. If any or all of the 4 tables do not have matching rows I still want to return a row from the
original table and anywhere a match was found.

I am using Visual Studio to create the stored procedure. From what I have
read the VS default is to create inner joins. Do I need to use a Left join to acheive my goal?

Don

Jul 21 '05 #2

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

Similar topics

3
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName,...
4
by: inline_four | last post by:
If I have a table with multiple foreign keys to various other tables, what's the best way to index them: one index that contains all of those columns, or multiple indexes containing one foreign key...
1
by: csomberg | last post by:
SQL Server 2000 When joining tables, some use: AliasTableName.ColumnName = AliasTableName.Column while others use LEFT/RIGHT etc JOIN ....... Is one better than the other in cases where the...
5
by: Timur | last post by:
Hi gurus, I have a problem to convert MS SQL Server application to DB2. I have a view which combines 7 tables ( table sizes 60millions rows, 3 mill, 1 mill, other small ones) I use this view to...
2
by: Fendi Baba | last post by:
I created a person table with various fields such as Suffix, Salutation, etc, Some of these fields may not be mandatory for example suffix. In the actual table itself, I only have a field for...
13
by: john | last post by:
I have table User-App and table App Profile User-App App Profile IDuser IDApp IDApp 1 34 34 1 45 45 2 34 2 45 2 90 3 34
3
by: Veeru71 | last post by:
I am not able to really understand the explain plan output in case of hash joins. When tables A & B are being joined, how do I know which table is being hashed during first phase (build phase) ?...
6
by: dunleav1 | last post by:
I have an application that uses the old join syntax instead of the SQL92 standards join syntax. I need to justify changing the code to the new standard. Is there any performance issue related to...
6
by: loffing4 | last post by:
I'm trying to write a query that selects the top five members of a forum based on how many total points they have. A member's total points are calculated as follows: (3 * # answers posted) + (10 * #...
36
by: TC | last post by:
I've used Access for many years. Several times, I've encountered a bug which I refer to as the "Vanishing Joins" bug. When it happens, joins vanish randomly from queries. More specifically, all...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.