My table structure is as follows:
date Id Value
--------------------------------
01/01/2005 50000 5
01/01/2006 50000 6
01/01/2007 50000 7
01/01/2005 50001 8
01/01/2006 50001 9
01/01/2007 50001 10
I would like to output the xml using for xml
in SQL Server in the following format:
<Date date = "01/01/2005"> <Id dealId=50000" value="5"/> <Id dealId=50001" value="8"/> </Date> <Date date = "01/01/2006"> <Id dealId=50000" value="6"/> <Id dealId=50001" value="9"/> </Date>
It would be of great help if someone can help me out with the query in SQL Server. I have tried couple of them myself but I am not getting the exact output.