0

我有表客户

 customerno   sname   contactid  address
  1           aaa       101       north
  1            bbb      102        south
  1            ccc       103       west
  2           ddd        104       south
  2           ccc        105       north
  2            eee        106       null

我想将特定的客户详细信息转换为单行。我想要这样的结果

Customerno    sname1    sname2   sname3  address1  address2     address3
  1            aaa       bbb      ccc     north     south         west
  2            ddd       ccc      eee     south      north         null

帮我 ........

4

1 回答 1

1

这在本质上与下面的问题非常相似。请查看答案以获得指导。由于您要“旋转”超过 1 列,我认为这个问题只能通过一些自连接来解决。

将行转换为列

不要偏袒你,这是我的答案:) ...

将行转换为列

于 2010-11-25T20:08:21.157 回答