sql sum prev month - hot!

0

Hello dear community, I have a huge problem that I have already spent a lot of time and effort, the computer with the jasperserver server is on site without remote access and where there is no internet. To try some version I have to go to the server ...

I need to form a simple SQL query:

It is necessary to summarize some values for the previous month.

In the usual sql I would do as and everywhere recommend

SELECT SUM(`test1`) FROM `test` WHERE   
`datetime` > LAST_DAY( DATE_SUB( CURDATE( ) , INTERVAL 2 MONTH ) ) + INTERVAL 1 DAY   
AND  `datetime` < DATE_ADD( LAST_DAY( CURDATE( ) - INTERVAL 1 MONTH ) , INTERVAL 1 DAY ) 

But this syntax does not work. How to make this in JasperSoft studio 6.0.1?

mda1234's picture
Joined: May 25 2017 - 7:39am
Last seen: 1 year 9 months ago

Someone pls? Mb some information in docs about this?

mda1234 - 1 year 9 months ago

0 Answers:

No answers yet
Feedback