COALESCE() returns the first
NON NULL value in a list of arguments. Suppose we had a table containing phone numbers, and cell phone numbers and wanted to return only one for each user. In order to only obtain one, we can get the first
NON NULL value.
DECLARE @Table TABLE (UserID int, PhoneNumber varchar(12), CellNumber varchar(12)) INSERT INTO @Table (UserID, PhoneNumber, CellNumber) VALUES (1,'555-869-1123',NULL), (2,'555-123-7415','555-846-7786'), (3,NULL,'555-456-8521') SELECT UserID, COALESCE(PhoneNumber, CellNumber) FROM @Table