Try:
SELECT C.CustomerId, C.CustomerName, C.StatusId, I.AuthorityId
FROM Customer C
LEFT JOIN Identifier I ON I.CustomerId = C.CustomerId and I.AuthorityId = 11
WHERE C.StatusId = 1
ORDER BY C.CustomerName
Answer from user359040 on Stack OverflowVideos
Try:
SELECT C.CustomerId, C.CustomerName, C.StatusId, I.AuthorityId
FROM Customer C
LEFT JOIN Identifier I ON I.CustomerId = C.CustomerId and I.AuthorityId = 11
WHERE C.StatusId = 1
ORDER BY C.CustomerName
just change JOIN into LEFT JOIN
SELECT C.CustomerId, C.CustomerName, C.StatusId, I.AuthorityId
FROM Customer C
LEFT JOIN Identifier I ON I.CustomerId = C.CustomerId
WHERE C.StatusId = 1
AND I.AuthorityId = 11
ORDER BY C.CustomerName
UPDATE
if you want to change (NULL) value into NULL or whatever word you want to replace, you can you COALESCE
SELECT C.CustomerId, C.CustomerName, C.StatusId, COALESCE(I.AuthorityId, 'whatever')
FROM Customer C
LEFT JOIN Identifier I ON I.CustomerId = C.CustomerId
WHERE C.StatusId = 1
AND I.AuthorityId = 11
ORDER BY C.CustomerName
If you want to add a and b and either may be null, you could use coalesce, which returns the first non-null parameter you pass it:
coalesce(a+b, a, b)
So in this case, if neither parameter is null, it will return the sum. If only b is null, it will skip a+b and return a. If a is null, it will skip a+b and a and return b, which will only be null if they are both null.
If you want the answer to be 0 rather than null if both a and b are null, you can pass 0 as the last parameter:
coalesce(a+b, a, b, 0)
Do consider @erwins answer - null might not be the right thing to be using.
I accomplished it this way:
coalesce("Column1",0.00) + coalesce("Column2",0.00)
I'm working with front end high level execs.... They don't understand why NULL and 0 aren't handled the same way.
In my case it works, just replacing NULLs with 0.00... may not in all though :)
I think Zack properly answered the question but just to cover all the bases:
Update myTable set MyColumn = NULL
This would set the entire column to null as the Question Title asks.
To set a specific row on a specific column to null use:
Update myTable set MyColumn = NULL where Field = Condition.
This would set a specific cell to null as the inner question asks.
If you've opened a table and you want to clear an existing value to NULL, click on the value, and press Ctrl+0.