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  | 
                             
                            
                                    | 
                                         anupalavila 
                                        Yak Posting Veteran 
                                         
                                        
                                        56 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2015-01-11 : 06:36:48
                                            
  | 
                                             
                                            
                                            | I have a table named activity with fields activityId,activitydate. How can I write a query to select activityId from the table between two dates in such a way that it returns values as a single row and if there is no activityId for a date in a month it should be 0ie.activityId   activitydate15              2015-01-01 00:00:00.00016              2015-01-03 00:00:00.00017              2015-01-04 00:00:00.00018              2015-01-06 00:00:00.00019              2015-01-10 00:00:00.00020              2015-01-12 00:00:00.000it show return the values like15 0 16 17 0 18 0 0 0 10 0 20Thanks and Regards Anu Palavila | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     gbritton 
                                    Master Smack Fu Yak Hacker 
                                     
                                    
                                    2780 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2015-01-11 : 08:23:57
                                          
  | 
                                         
                                        
                                          | what have you tried so far? Post the query that you have worked up.  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |