2
與此處的問題類似: http://forums.asp.net/t/1580379.aspx/1 我試圖將普通單元格合併到單個逗號分隔單元格中,但是通過內部連接。SQL從多行合併單元格到單個單元格
我的SQL是:
SELECT DISTINCT tb_Order.OrderNumber, tb_Order.OrderId,
tb_Order.orderDate, tb_Order.OrderTotal,
tb_OrderStatus.OrderStatus, tb_Order.GroupOrderId,
tb_Venue.Title AS Venue
FROM tb_Order INNER JOIN tb_OrderItem ON tb_Order.OrderId = tb_OrderItem.OrderId
INNER JOIN tb_Show ON tb_OrderItem.ShowId = tb_Show.showId
INNER JOIN tb_OrderStatus ON tb_Order.OrderStatusId = tb_OrderStatus.OrderStatusID
INNER JOIN tb_Venue ON tb_Show.VenueId = tb_Venue.id
WHERE (tb_Order.OrderId = 705)
我需要的[地點]以逗號分隔,如:
"Interactive Seating Chart Advanced, Interactive Seating Chart Mode Multi-Click"
看看http://stackoverflow.com/questions/905818/tsql-comma-separation/913023的 – lyrisey 2012-04-27 00:59:09
可能重複[SQL服務器?我可以用逗號分隔多行合併到一列(HTTP://計算器。 com/questions/2046037/sql-server-can-i-comma-delimit-multiple-rows-into-one-column) – 2012-04-27 09:48:02
Andriy - 不是重複的,因爲我正在嘗試使用連接來完成此操作。 – aron 2012-04-27 17:49:24