2
A
回答
4
您沒有相應的功能,但您仍然可以模擬(使用CROSS APPLY
和FOR XML PATH('')
)。例如,
USERID ADDRESSLINE1
==========================
1 First Street
1 Second Street
2 32th Street
2 24th Street
2 25th Street
將導致
USERID ADDRESSLIST
============================
1 First Street, Second Street
2 32th Street, 24th Street, 25th Street
使用此查詢:
SELECT a.UserID,
SUBSTRING(d.Addresses,1, LEN(d.Addresses) - 1) AddressList
FROM
(
SELECT DISTINCT UserID
FROM tableName
) a
CROSS APPLY
(
SELECT [AddressLine1] + ', '
FROM tableName AS B
WHERE A.UserID = B.UserID
FOR XML PATH('')
) D (Addresses)
SQLFiddle Demo
相關問題
- 1. 甲骨文解碼功能相當於在SQL服務器2005+
- 2. 相當於Windows服務功能的Linux?
- 3. SQL服務器相當於ORACLE INSTR
- 4. SQL服務器相當於Oracle用戶
- 5. Sql服務器相當於mysql_maketime
- 6. SQL服務器相當於GROUP_CONCAT()
- 7. 相當於PostgresQL的SQL服務器Openquery
- 8. SQL服務器CONCAT功能
- 9. 功能NHibernate QueryOver SQL「案例」相當於
- 10. 光標功能相當於在SQL Server
- 11. pandas:功能相當於SQL的datediff()?
- 12. VBA相當於SQL「在」功能
- 13. SQL Server 2000中相當於GROUP_CONCAT功能
- 14. Vnoremap功能相當於Spacemacs
- 15. Theano功能相當於Tensorflow
- 16. SQL服務器替換功能#2
- 17. SQL服務器 - 緩存內的功能
- 18. 理解DATEDIFF()的SQL服務器功能
- 19. SQL服務器電源功能discrepanacy?
- 20. SQL服務器 - 功能的程序
- 21. SQL服務器電源功能
- 22. SQL服務器LAST一樣的功能
- 23. Sql服務器 - 「地圖」功能?
- 24. Sql服務器功能運行緩慢
- 25. SQL服務器:透視功能錯誤
- 26. 服務器相當於Oracle的CREATE OR REPLACE查看SQL
- 27. Postgres的權限來創建對象,相當於SQL服務器
- 28. 從sql服務器的查詢相當於
- 29. SQL服務器相當於mysql的查詢
- 30. SQL服務器相當於加入甲骨文更新
http://stackoverflow.com/questions/1621747/concat-field-value -to-字符串在-SQL服務器 – Habib