| 
                
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 |  
                                    | shubhrabarStarting Member
 
 
                                        2 Posts | 
                                            
                                            |  Posted - 2012-04-11 : 03:59:31 
 |  
                                            | I need to generate quarterly supplier report for year. Can you tell me how can i do it? I got a hint from someone.that is-->-	 [SM Audit].[Year of Audit]=(case when month(getdate())=1 then( extract(year, getdate()) -1) else extract(year, getdate()) end) and Month([Presentation Layer].[SM Audit].[Date of Audit]) between (case when month(getdate())=1 then 10 else month(getdate())-3 end) and (case when month(getdate())=1 then 12 else month(getdate())-1 end) |  |  
                                    | SwePesoPatron Saint of Lost Yaks
 
 
                                    30421 Posts | 
                                        
                                          |  Posted - 2012-04-11 : 05:28:50 
 |  
                                          | The code above is NOT for quarterly report. It is for last three months, which is not the same as last/current quarter.Also, are you using Microsoft SQL Server? N 56°04'39.26"E 12°55'05.63"
 |  
                                          |  |  |  
                                    | shubhrabarStarting Member
 
 
                                    2 Posts | 
                                        
                                          |  Posted - 2012-04-11 : 09:01:37 
 |  
                                          | Yes i am using  Microsoft SQL Server 2008 r2.see I am new to Ms sql server. And i am not getting this syntax. If i want to make it a query ,what and how can i do it? can you make it?  i have to make this query from one column which datatype is like "2007-06-14 00:00:00.000"...and can u plz sujjest me how can i make quarterly report? i have to make a scheduled report using query – Run on the 15th day of every 3 months, specifically January, April, July, October. |  
                                          |  |  |  
                                    | SwePesoPatron Saint of Lost Yaks
 
 
                                    30421 Posts | 
                                        
                                          |  Posted - 2012-04-11 : 09:29:40 
 |  
                                          | SELECT * FROM dbo.Table1WHERE Col1 >= DATEADD(QUARTER, DATEDIFF(QUARTER, '19000401', GETDATE()), '19000101')AND Col1 < DATEADD(QUARTER, DATEDIFF(QUARTER, '19000101', GETDATE()), '19000101') N 56°04'39.26"E 12°55'05.63"
 |  
                                          |  |  |  
                                |  |  |  |  |  |