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 |
|
kmslick
Starting Member
6 Posts |
Posted - 2011-04-05 : 12:39:58
|
| I need to create a view where table B is left joined to table A. There may not be a matching row in table B. The new view field should simply be "Y" if there is a valid joined row or "N" of not (NULL).I'm assuming I would use some combination of "case when" with a subquery but am not quite sure to return Y/N values.Any help is appreciated. |
|
|
sunitabeck
Master Smack Fu Yak Hacker
5155 Posts |
Posted - 2011-04-05 : 12:47:01
|
| [code]select case when b.JoinColumnB is null then 'N' else 'Y' end as YesNofrom TableA a left join TableB b on a.JoinColumnA = b.JoinColumnB[/code] |
 |
|
|
kmslick
Starting Member
6 Posts |
Posted - 2011-04-05 : 15:26:36
|
| Great, thank you! |
 |
|
|
|
|
|