Created
October 22, 2018 21:26
-
-
Save sigma23/0f5e2b133255b0fe2d87cacebbb202d2 to your computer and use it in GitHub Desktop.
To do a join in sql and also keep null values
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
select B.*, A.* | |
from B | |
left outer join A ON | |
(A.[id1] = B.[id1] or (coalesce(A.[id1],B.[id1]) is null)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment