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  | 
                             
                            
                                    | 
                                         usafelix 
                                        Posting Yak  Master 
                                         
                                        
                                        165 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2014-08-22 : 15:27:54
                                            
  | 
                                             
                                            
                                            | date              shop    sku       staff     qty  amt 0813 13:20   hk       book     david      2     500813 18:20   usa     toy         mary      1    150813  09:15  hk       cake       ken         3     3500813  13:40  can     toy          mak        7    10i want...                       shop    sku    staff       qty    amt0813 0915   hk       cake    ken         3     3500813 13:20  hk       book   david      2     50                      total : 5 qty  $4000813  13:40 can      toy       mak.     7    $ 10                      total : 7qty  $100813   18:20 usa      toy      mary    1     $10total : 13 qtygrand total : 420 it is any easy way to write a simple query ? | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     James K 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    3873 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2014-08-22 : 16:27:35
                                          
  | 
                                         
                                        
                                          quote: Originally posted by usafelix date              shop    sku       staff     qty  amt 0813 13:20   hk       book     david      2     500813 18:20   usa     toy         mary      1    150813  09:15  hk       cake       ken         3     3500813  13:40  can     toy          mak        7    10i want...                       shop    sku    staff       qty    amt0813 0915   hk       cake    ken         3     3500813 13:20  hk       book   david      2     50                      total : 5 qty  $4000813  13:40 can      toy       mak.     7    $ 10                      total : 7qty  $100813   18:20 usa      toy      mary    1     $10total : 13 qtygrand total : 420 it is any easy way to write a simple query ?
  In simple queries, SQL Server can output only tabular data - i.e., every row will have the same number of columns, and every column would have the same type of data.  The output you want does not appear to be such tabular data.To produce reports such as what you are looking for a reporting tool (SQL Reporting Services, Crystal Reports etc.) are more suitable.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |