Please start any new threads on our new 
    site at https://forums.sqlteam.com.  We've got lots of great SQL Server
    experts to answer whatever question you can come up with.
    
        
            
                
                    
                        
                            
                                | Author | 
                                
                                 Topic  | 
                             
                            
                                    | 
                                         orenshto 
                                        Starting Member 
                                         
                                        
                                        3 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2015-06-22 : 07:08:57
                                            
  | 
                                             
                                            
                                            | Hey,I've got the following table structure:UDI	description	VALUE	Units	      client_id10	Customer id	10247	CID	      1024720	Customer Name	ABC	CUST_NAME     1024710	Customer id	12261	CID	      1226120	Customer Name	DEF	CUST_NAME     12261two rows for each customer ID, each customer has 2 UDI (10, 20).I would like to have  a query which will generate the following:<Customer><Datum UDI="10" Description="Customer ID" Value="10247" Units="CID" /><Datum UDI="20" Description="Customer Name" Value="ABC" Units="CUST_NAME" /></Customer><Customer><Datum UDI="10" Description="Customer ID" Value="12261" Units="CID" /><Datum UDI="20" Description="Customer Name" Value="DEF" Units="CUST_NAME" /></Customer>each client ID will have 2 rows and every client ID will generate new customer. | 
                                             
                                         
                                     | 
                             
       
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |