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 |
|
kode82
Starting Member
2 Posts |
Posted - 2009-09-09 : 08:33:47
|
| Hi, everyone!I would appreciate some help/guidance because at the moment I am not sure for what to search the internet.So for example I have two tablestBooksbookid/booktitle/countryid1/book1/122/book2/NULL3/book3/23tCountrycountryid/country12/Country123/Country2In SELECT result I would like to get all the records in tBook table, so that in countryid column I would get either the name of the appropriate country or NULL (or empty string, or something else) value if there was null in the first place.If I will write WHERE statement then the second row will be left out because of the NULL value.So the question is what query structure will be the best to use in this situation.Thanks for reading. |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-09-09 : 08:36:11
|
| Try left join!Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
kode82
Starting Member
2 Posts |
Posted - 2009-09-09 : 09:06:40
|
| Thanks Senthil.It worked fine. |
 |
|
|
|
|
|