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 |
Zath
Constraint Violating Yak Guru
298 Posts |
Posted - 2012-05-22 : 12:16:15
|
Most of the time, there will be no record in the LEFT OUTER JOIN BELOWSELECT tbl1.Name,tblJOIN.Code FROM MyTable tbl1LEFT OUTER JOIN MyJoinTable tblJOIN on tblJOIN.ID = tbl1.ID So, if tblJOIN.Code comes back empty or null, set it to 0.Just can't seem to get the syntax right to set it to 0.Thanks!!! |
|
jimf
Master Smack Fu Yak Hacker
2875 Posts |
Posted - 2012-05-22 : 12:17:55
|
SELECT tbl1.Name,ISNULL(tblJOIN.Code,0) FROM MyTable tbl1LEFT OUTER JOIN MyJoinTable tblJOIN on tblJOIN.ID = tbl1.IDJimEveryday I learn something that somebody else already knew |
 |
|
|
|
|