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 |
|
ppuar
Starting Member
28 Posts |
Posted - 2002-11-12 : 13:53:45
|
| Here is my code I am having problems with:select iIndividualId, (select chRegionName from region where chRegionCode = i.chRegionCode and chCountryCode = i.chCountryCode)from individual as iwhere i.iIndividualId = 22222222When I run this query with region code blank and country code with 'CA', then I should get no results back. However, instead of returning blank it returns null. The problem is that I don't NULL.I have also tried the following with no sucess: (select isnull(chRegionName, '') from region where chRegionCode = i.chRegionCode and chCountryCode = i.chCountryCode)from individual as iwhere i.iIndividualId = 22222222Does anyone know what I am doing wrong?Thanks Pardeep |
|
|
motokevin
Starting Member
36 Posts |
Posted - 2002-11-12 : 14:01:01
|
| Try This:SELECT i.IndividualID, ISNULL(r.chRegionName, '')FROM Individual iLEFT OUTER JOIN Region r On (i.chRegionCode = r.chRegionCode AND i.chCountryCode = r.chCountryCode)WHERE i.IndividualID = 22222222 |
 |
|
|
ppuar
Starting Member
28 Posts |
Posted - 2002-11-12 : 14:09:39
|
| Thanks it worked |
 |
|
|
|
|
|