1
+--------------------------+
| inv_num scn |
+--------------------------+
| MI1001 160008 |
| CI1002 160008 |
| VI1003 160008 |
+--------------------------+
MI爲雜項,CI爲貨物,VI爲船隻。
我需要在SQL結果顯示像
+------------------------------------------------+
| scn Misc Cargo Vessel |
+------------------------------------------------+
| 160008 MI1001 CI1002 VI1003 |
+------------------------------------------------+
我是新來這種事情,所以不知道該怎麼辦查詢。
可能的重複[將行轉換爲使用SQL Server中的'透視'列)(http://stackoverflow.com/questions/15931607/convert-rows-to-columns-using-pivot-in-sql-server) – GurV