You are here: Re: Need help returning a null value, please « MsSQL Server « IT news, forums, messages
Re: Need help returning a null value, please

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)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация