SQLSERVER中合并多条记录为一条

时间:2022-01-30 02:59:26

     根据业务需要,在水晶报表中把数据库的多条记录显示为整合为一条。即把同一ID号的出件接收时间整合为一条,且标识出是第几条的接收时间。

     数据库中的数据样式如下:
          SAID      ReceivedDate
          000104   2006-03-01
          000104   2006-03-04
          000104   2006-03-07
          000104   2006-03-08
          000105   2006-08-09

-----------水晶报表中显示的样式为:
         SAID       1st Received Date     2nd Received Date     3rd Received Date   4th Received Date
         000104         2006-03-01             2006-03-04                2006-03-07          2006-03-08
         000105         2006-08-09
---------------------SQL语句为:


SQLSERVER中合并多条记录为一条SQLSERVER中合并多条记录为一条Code