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 |
AdamWest
Constraint Violating Yak Guru
360 Posts |
Posted - 2015-02-12 : 08:52:18
|
I am not sure here on the syntax. I want to join file a and file bwhere a.ent = b.ent and a.suf - b.suf i want one col from file bwhich is grc# even if blank.Select * from mylib.filea a left joinhislib.fileb bwhere a.ent = b.entand a.suf = b.suf |
|
gbritton
Master Smack Fu Yak Hacker
2780 Posts |
Posted - 2015-02-12 : 09:28:14
|
[code]Select * from mylib.filea a left join hislib.fileb bon a.ent = b.entand a.suf = b.suf[/code]use ON instead of WHERE. ON is the matching predicate. For LEFT JOINs, it will match on either equal values or nulls, if there are no matching rows from the right side of the join. WHERE is a filtering predicate so would filter out rows where a.ent <> b.ent. If either one is null, the predicate returns false. |
|
|
|
|
|