SQL to combine records only if data is available I have a table with the following format:

id      description1       description2
123     null               abcd
123     zyxw               abcd
124     null               efgh
124     vuts               efgh
125     null               ijkl
126     null               mnop


Basically, I want SQL to return a single record for 123 and 124 that contains description1, instead of displaying two records for each, one with a null description1. But if there is no description1 in any record of the same id and description2, simply display null. So that the data displayed would be:

id    description1    description2
123   zyxw            abcd
124   vuts            efgh
125   null            ijkl
126   null            mnop
SELECT id,
description1 = MAX(description1),
description2 = MAX(description2)
FROM dbo.MyTable
GROUP BY id
ORDER BY id;