Jump to content

SQL between start & end of last month


Lauren

Recommended Posts

Hi

I am trying to create a widget that displays requests resolved between the start and end of last month. I keep getting errors using the query I've inputted - I must confess I am no SQL expert. 

Is someone able to confirm the query I'd need?

Thanks
Lauren

Link to comment
Share on other sites

Hi @Lauren

The following should give you the results you need. This will give you the previous months results based on the current date:

image.png

 

Here is the text if you would like to copy and paste:

YEAR(h_dateresolved) = YEAR(CURRENT_DATE - INTERVAL 1 MONTH) AND MONTH(h_dateresolved) = MONTH(CURRENT_DATE - INTERVAL 1 MONTH)

 

Kind Regards

Bob

  • Like 3
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...