We help IT Professionals succeed at work.
Get Started

Left Join

264 Views
Last Modified: 2011-10-19
I have two select quiers which I want to left join. However when I try the left join SQL Server 2005 changes the code to read LEFT OUTER JOIN.

Here is a sample of my code:

SELECT     tb1.AttDate AS Attendance_Date, SUM(tb1.Rows1) AS RW3, SUM(tb2.Rows1) AS RW4
FROM         (SELECT     RowID, AttendanceDate, Derived_Provider, 1 AS Rows1, CAST(MONTH(AttendanceDate) AS VarChar(20)) + '-' + CAST(YEAR(AttendanceDate)
                                              AS VarChar(20)) AS AttDate
                       FROM          OPA_General AS OPA_General
                       WHERE      (AttendanceDate BETWEEN CONVERT(DATETIME, '17/09/2007 00:00:00', 103) AND CONVERT(DATETIME, '17/09/2008 00:00:00', 103)) AND
                                              (LEFT(Derived_Provider, 3) = 'RW3')) AS tb1 LEFT OUTER JOIN
                          (SELECT     RowID, AttendanceDate, Derived_Provider, 1 AS Rows1, CAST(MONTH(AttendanceDate) AS VarChar(20)) + '-' + CAST(YEAR(AttendanceDate)
                                                    AS VarChar(20)) AS AttDate
                            FROM          OPA_General AS OPA_General
                            WHERE      (AttendanceDate BETWEEN CONVERT(DATETIME, '03/01/2008 00:00:00', 103) AND CONVERT(DATETIME, '05/01/2008 00:00:00', 103)) AND
                                                    (LEFT(Derived_Provider, 3) = 'RW6')) AS tb2 ON tb1.AttDate = tb2.AttDate
GROUP BY tb1.Derived_Provider, tb1.AttDate

Thanks
Comment
Watch Question
CERTIFIED EXPERT
Awarded 2008
Awarded 2008
Commented:
This problem has been solved!
Unlock 1 Answer and 11 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE