Advertisement

02.18.2008 at 07:36PM PST, ID: 23173329
[x]
Attachment Details

How would you interpret the left join in the following SQL Statement  ?

Asked by zimmer9 in MS SQL Server, SQL Query Syntax, SQL Server 2005

I am developing an Access application using Access as the front end and SQL Server as the back end database.

In the following snippet of code representing a SQL statement, I am trying to understand how the LEFT JOIN statement works.

I use a table named tblStatesAll with 50 records that has a 2 character value for all 50 states with values such as AK, AL, AR, AZ

I also have a table named tblCustomersNew that has a field named ResStateCode with the same 2 character state values.

I'm just trying to understand what the meaning of the LEFT JOIN would be in this SQL Statement with respect to the table values.



Start Free Trial
1:
2:
3:
4:
5:
FROM dbo.tblCustomersNew As C  
INNER JOIN dbo.tblProductsNew As P ON C.CustomerNumber = P.CustomerNumber AND C.OfficeNumber = P.OfficeNumber
INNER JOIN dbo.tblA1099Match As T ON Right(C.OfficeNumber,3) = Left(T.Accounts1099,3)   
AND C.CustomerNumber = Right(T.Accounts1099,6)   
LEFT JOIN dbo.tblStatesAll AS S ON S.StateFS = C.ResStateCode
[+][-]02.18.2008 at 07:52PM PST, ID: 20925571

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.18.2008 at 08:12PM PST, ID: 20925643

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.18.2008 at 08:21PM PST, ID: 20925683

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.18.2008 at 08:54PM PST, ID: 20925838

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]02.18.2008 at 08:57PM PST, ID: 20925851

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]02.18.2008 at 09:12PM PST, ID: 20925902

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: MS SQL Server, SQL Query Syntax, SQL Server 2005
Sign Up Now!
Solution Provided By: dqmq
Participating Experts: 3
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628