Posted by David Portas on 10/13/05 14:27
Why did you return an "F" for one row and NULL for the others? I'm
guessing that you only want to return a value in the second column
where that value is the same for every instance of the value in the
first column. I'm also guessing that both columns are not nullable in
your table (because you didn't specify any other columns that could be
a key). If that's correct, try this:
SELECT col1,
CASE WHEN MIN(col2)=MAX(col2) THEN MIN(col2) END AS col2
FROM your_table
GROUP BY col1;
(untested)
--
David Portas
SQL Server MVP
--
Navigation:
[Reply to this message]
|