I currently have a SQL query that returns a number of fields. I need one f the fields to be effectively a sub query sub that.
The Problem in detail:
If I have a table X with two columns, ModuleID and say ModuleValue, how can I write a SQL query to take the results and Concatenate it into one field:
(SELECT ModuleValue FROM Table_X WHERE ModuleID=@ModuleID)
Value 1, Value 2, Value 3
DB is MS TSQL (2005)
With MSSQL you can do something like this:
declare @result varchar(500) set @result = '' select @result = @result + ModuleValue + ', ' from TableX where ModuleId = @ModuleId