GROUP BY for MAX and NULL
<p>I want max <code>startdate</code> but there is a <code>NULL</code> data, it will be null.</p>

<p>Sample data is as follows:</p>

<pre><code>DECLARE @Tbl TABLE (Id INT, StartDate DATETIME)

INSERT INTO @Tbl
VALUES (1, NULL),
(1, '2016.07.30'),
(1, '2016.07.05'),
(1, '2016.07.05'),
(2, '2016.07.07'),
(2, '2016.07.05'),
(3, '2016.07.05'),
(3, NULL)
</code></pre>

<p>My Query:</p>

<pre><code>SELECT Id, MAX(StartDate) AS StartDate
FROM @Tbl
GROUP BY Id
</code></pre>

<p>Output:</p>

<pre><code>Id          StartDate
----------- ----------
1           2016-07-30
2           2016-07-07
3           2016-07-05
</code></pre>

<p>Desired Output:</p>

<pre><code>Id          StartDate
----------- ----------
1           NULL
2           2016-07-07
3           NULL
</code></pre>