How to transform rows to columns

后端 未结 4 393
Happy的楠姐
Happy的楠姐 2020-12-06 02:54

I have a simple problem when querying the SQL Server 2005 database. I have tables called Customer and Products (1->M). One customer has most 2 products. Instead of output as

4条回答
  •  萌比男神i
    2020-12-06 03:07

    Here two link about pivot:

    http://www.tsqltutorials.com/pivot.php

    http://www.simple-talk.com/sql/t-sql-programming/creating-cross-tab-queries-and-pivot-tables-in-sql/

    I solve my problem with pivot ;)

提交回复
热议问题