开发者

How to retrieve a comma separated list for MSAccess SQL

I am having difficulty retrieving a comma separated list from MSAccess using SQL. It is very easy to do with SQL Server an开发者_JAVA技巧d I have accomplished it there. But the MSAccess solution seems to elude me.

DECLARE @EmployeeList varchar(100)

SELECT @EmployeeList = COALESCE(@EmployeeList + ', ', '') + 
       CAST(Emp_UniqueID AS varchar(5))
FROM SalesCallsEmployees
WHERE SalCal_UniqueID = 1

SELECT @EmployeeList

http://www.sqlteam.com/article/using-coalesce-to-build-comma-delimited-string

Has anybody accomplished this using MS Access or am I just doomed to never getting lists like this through SQL?


You can select the fields (columns) one by one:

SELECT ID & ",", Other & "," 
FROM table
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜