Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
wsilage
Yak Posting Veteran
82 Posts |
Posted - 2014-08-08 : 10:47:14
|
I have this query that I am building. I have a spreadsheet that I need to find the pcs numbers for. The master file is called Jeffcred_InitialAppts_step1. Everything is pulling, but I am having problems with finding the ones with the middle initial that are NULL.How can I have the names that are equaled to the middle initial and also pull the ones that are equal to null middle initialsSelect Distinctpcs_id1,[Last Names],---------------pcs_lname as ImpactLastName,[First Names],[Middle initials],Degree,Specialty,TIN_FULL,[TIN 2],NPI_FULL,[Type (Initial or Recred)],[First Credentialing Date],[Most Recent Recredentialing Date]from JEFFCRED_INITIALAPPTS_Step1LEFT JOIN impact.dbo.pcs on [Last Names] = pcs_lname and [First Names] = pcs_fname and [Middle initials] = pcs_minitorder by pcs_id1 |
|
bitsmed
Aged Yak Warrior
545 Posts |
Posted - 2014-08-08 : 11:22:58
|
quote: Originally posted by wsilageSelect Distinctpcs_id1,[Last Names],---------------pcs_lname as ImpactLastName,[First Names],[Middle initials],Degree,Specialty,TIN_FULL,[TIN 2],NPI_FULL,[Type (Initial or Recred)],[First Credentialing Date],[Most Recent Recredentialing Date]from JEFFCRED_INITIALAPPTS_Step1LEFT JOIN impact.dbo.pcs on [Last Names] = pcs_lname and [First Names] = pcs_fname and isnull([Middle initials],'') = isnull(pcs_minit,'')order by pcs_id1
|
|
|
Bustaz Kool
Master Smack Fu Yak Hacker
1834 Posts |
Posted - 2014-08-08 : 11:24:37
|
[code]and ( [Middle initials] = pcs_minit or ([Middle initials] is Null and pcs_minit is null) )[/code][Soapbox]The coding gets simpler, with the attending increase in performance, if you don't allow NULLs but default to an empty string. Most items that are defined as nullable can be treated in a similar manner.[/Soapbox] Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy |
|
|
|
|
|
|
|