was trying to retrieve Syslog information on a monthly basis but DataMiner application is unable
Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 13th July 2023
Hi Seetharam,
Does this query work for you? The difference is that the month is subtracted outside the MONTH().
SELECT * FROM info WHERE YEAR(toa) = YEAR(NOW()) AND MONTH(toa) = MONTH(NOW()) -1
Marieke Goethals [SLC] [DevOps Catalyst] Selected answer as best 13th July 2023
To avoid issues when running this query in December, it might be better to do:
SELECT * FROM info WHERE YEAR(toa) = YEAR(ADDDATE(NOW(), INTERVAL -1 MONTH)) AND MONTH(toa) = MONTH(ADDDATE(NOW(), INTERVAL -1 MONTH))