开发者

How to retrieve a comma separated list for MSAccess SQL

开发者 https://www.devze.com 2023-01-24 08:59 出处:网络
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

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

精彩评论

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

关注公众号