|
Posted by Hugo Kornelis on 10/01/17 11:17
On 31 May 2005 12:15:27 -0700, Stu wrote:
>Use a LEFT JOIN instead of an INNER JOIN.
>
>SELECT a.SSN, a.MonthName, a.IMClinicDay,
>b.IMClinicDay as SecondDay
>FROM tblResidentRotations a LEFT JOIN view7 b ON a.SSN = b.SSN
>WHERE a.AcademicYear = '2004-2005'
> AND a.SSN = '999999999'
> AND datename(month, a.IMClinicDateFirst) = b.MonthName
>
>HTH
>Stu
Hi Stu,
One correction. The last line of the WHERE clause has to move to the ON
clause:
SELECT a.SSN, a.MonthName, a.IMClinicDay,
b.IMClinicDay as SecondDay
FROM tblResidentRotations a
LEFT JOIN view7 b
ON a.SSN = b.SSN
AND datename(month, a.IMClinicDateFirst) = b.MonthName
WHERE a.AcademicYear = '2004-2005'
AND a.SSN = '999999999'
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)
[Back to original message]
|