I'm just trying to concatenate the names of employees into a single field whenever the WorkOrderNumber value of an entry is the same.
$Data = "SELECT tt.WorkOrderNumber AS WN,
SUBSTRING(SELECT tt2.AssignedEmp
FROM TestTable AS tt2
WHERE tt2.WorkOrderNumber=tt.WorkOrderNumber
ORDER BY tt2.AssignedEmp) AS emp
FROM TestTable AS tt";
Whenever I run this query I get this returned on my site:
Warning: odbc_exec(): SQL error: [Microsoft][ODBC Microsoft Access Driver] At most one record can be returned by this subquery.
Is there something I'm missing?
For clarification... I'm shooting for:
Lets say I have data in this form
WorkOrderNumber AssignedEmp
2012087-28 Jeff
2012087-28 Bill
2012087-28 John
I'd like to query this data and get a result like this...
WorkOrderNumber Employee
2012087-28 Jeff,Bill,John