markknowsley
Programmer
Imagine I have the following table:
|*******|*******|*********|
| EmpID | Value | History |
|*******|*******|*********|
| 000001| 13.62 | |
| 000001| 20.22 | |
| 000001| 12.90 | |
| 000004| 18.11 | |
| 000004| 30.01 | |
| 000004| 15.90 | |
|*******|*******|*********|
(doesn't line up perfectly, sorry, but you get the idea )
What I want to do is write a SQL statement that will concatenate the results values for each seperate EmpID and insert these values into the History column. So, where the EmpID is 000001 I want to see '13.62, 20.22, 12.90' in all three History fields where EmpID = 000001 and '18.11, 30.01, 15.90 in all three History fields where EmpID = '000004'.
I've worked out how to generate the string using the COALESCE command in SQL, what I'm struggling to do is work out how I can run the command for each row in the database table.
Any help much appreciated.
Mark.
|*******|*******|*********|
| EmpID | Value | History |
|*******|*******|*********|
| 000001| 13.62 | |
| 000001| 20.22 | |
| 000001| 12.90 | |
| 000004| 18.11 | |
| 000004| 30.01 | |
| 000004| 15.90 | |
|*******|*******|*********|
(doesn't line up perfectly, sorry, but you get the idea )
What I want to do is write a SQL statement that will concatenate the results values for each seperate EmpID and insert these values into the History column. So, where the EmpID is 000001 I want to see '13.62, 20.22, 12.90' in all three History fields where EmpID = 000001 and '18.11, 30.01, 15.90 in all three History fields where EmpID = '000004'.
I've worked out how to generate the string using the COALESCE command in SQL, what I'm struggling to do is work out how I can run the command for each row in the database table.
Any help much appreciated.
Mark.