Sql server 合并表的行
要通过Sql server 合并表的行,sql-server,Sql Server,要通过ID将行合并为2,需要通过跳过空值来合并列DocStatus和Release Date 基本上,您可以将GROUP BY与聚合函数一起使用。像下面这样 SELECT ID, somecol, max(another_column), min(yet_another_column) FROM yourtable GROUP BY ID, somecol 请参阅图像以获取输出参考。
ID
将行合并为2,需要通过跳过空值来合并列DocStatus
和Release Date
基本上,您可以将GROUP BY与聚合函数一起使用。像下面这样
SELECT ID, somecol, max(another_column), min(yet_another_column)
FROM yourtable
GROUP BY ID, somecol
请参阅图像以获取输出参考。