合并表的行

时间:2016-03-07 06:35:39

标签: sql-server

想要通过ID将行合并为2,需要通过跳过空值来合并列DocStatusRelease Date

enter image description here

1 个答案:

答案 0 :(得分:1)

基本上你可以使用GROUP BY和聚合函数。类似下面的内容

SELECT   ID, somecol, max(another_column), min(yet_another_column)
FROM   yourtable
GROUP BY ID, somecol