hpesojrevilo Posted July 26, 2019 Share Posted July 26, 2019 Hi, I want to be able to filter by date looking back 6 months. I then want to include data from 12 months, 18 months, 24 months etc How would i do this without having to repeat myself? Currently i am using the below and then repeating it e.g between dateadd(dd,-189,getdate()) and dateadd(dd,-183,getdate()) between dateadd(dd,-373,getdate()) and dateadd(dd,-366,getdate()) Thanks in Advance, Link to comment Share on other sites More sharing options...
justsomeguy Posted July 29, 2019 Share Posted July 29, 2019 SQL doesn't have a way to say "group by every 6 months", you just have to explicitly tell it what you want. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now