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
精彩评论