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  | 
                             
                            
                                    | 
                                         Amateurtje 
                                        Starting Member 
                                         
                                        
                                        5 Posts  | 
                                        
                                        
                                            
                                            
                                             Posted - 2011-06-09 : 17:45:42
                                            
  | 
                                             
                                            
                                            | hello all,I have a table I want to make a graph from. To make this graph I need to produce a table as given below in the example.I have a table with projects with Startdates and enddates. During the project each project uses a amount of capacity. I want to make a line graph of the total amount of capacity used inbetween two dates (beginning and end of the graph. This total amount changes at each start of enddate therefore I need to make the first column of all start and enddates combined with a second column with the sum of the amounts.Problem:Question: How do I make the table as in the endresult.Input:Project II StartDate II Enddate II Amount (Amount of people working)Proj1      II 1 feb      II 1 april      II 4 Proj2      II 1 feb      II 1 May      II 2Proj3      II 1 jan      II 1 april      II 5From two comboboxes I get a Graphenddate and an Grapstartdate. This I can include with a "where"and "between" statement. The table below is the table I need to make the graph.Desired table endresult:Enddates and startdates (sorted upward)II [red]Total amount [/red](on that date)1 jan II 51 feb II 111 apr II 21 may II 0Can anybody help me with the sql statement (query)? If you know a part of it you can already help me on the way. The problems I see are two things:- To get all the end dates and the start dates in one column.- to get the total sum of the amounts per date. | 
                                             
                                         
                                     | 
                             
       
                            
                       
                          
                            
                                    | 
                                     Edrovi 
                                    Starting Member 
                                     
                                    
                                    2 Posts  | 
                                    
                                      
                                        
                                          
                                           
                                            Posted - 2011-06-24 : 17:41:30
                                          
  | 
                                         
                                        
                                          | Have you thought of using VB to fill your table, instead of using a single query...? I think that's a better approach...You can make a query to identify your project's start and end dates, and then use those results to calculate for each one of them your "Total amount".Hope I understood your problem and this may help... and I'm not too late to help.Good luck!Ed Rosales  | 
                                         
                                        
                                            | 
                                         
                                       
                                     | 
                                   
                            
                            
                                | 
                                    
                                      
                                     
                                    
                                 | 
                             
                         
                     | 
                 
             
         |