I am new to SQL xml operations. I have a problem with SQL & XML Parsing.
I have a Table named Task
. It has 3 columns:
- Name
- Task
- Date
Task
is saving in Hours worked as an xml in the following format:
<TASK>
<A>1</A>
<B>4</B>
<C>0</C>
</TASK>
My table will look like this (with multiple employees)
Name | Task | Date
========================================================================
Employee2219 | <TASK><A>1</A><B>4</B><C>0</C></ TASK > | 2014-01-28
Employee2219 | <TASK><A>3</A><B>2</B><C>1</C></ TASK > | 2014-01-29
....
I need to calculate the hours spend per employee for each task in a week like:
Name | A | B | C | D
===============================
Employee2219 | 4 | 6 | 1 | 0
....
I am new to XML and I could not work this out.