Well, how do I get the last day of the previous month dynamically (associated with the current date);
I have a column that is associated with the date in Milliseconds 'wo.CREATEDTIME' - Example of some dates in this format:
>1527807600000
1143564400000
SELECT Count(wo.WORKORDERID) AS "Request ID",
CASE
WHEN cd.CATEGORYNAME = '01 RMS Application' THEN 'Aplicação'
ELSE cd.CATEGORYNAME
END AS Category
FROM WorkOrder wo
LEFT JOIN WorkOrderStates wos
ON wo.WORKORDERID=wos.WORKORDERID
LEFT JOIN CategoryDefinition cd
ON wos.CATEGORYID=cd.CATEGORYID
WHERE (((wo.CREATEDTIME >= 1527807600000)
AND ((wo.CREATEDTIME != 0)
AND (wo.CREATEDTIME IS NOT NULL)))
**AND ((wo.CREATEDTIME <= 1530399599000)**
AND (((wo.CREATEDTIME != 0)
AND (wo.CREATEDTIME IS NOT NULL))
AND (wo.CREATEDTIME != -1))))
AND wo.ISPARENT='1'
AND wo.IS_CATALOG_TEMPLATE='0'
Group By 2
Order By 1 DESC LIMIT 5
In the Where Part I suppose it is there that you need to do the condition: How do I say that wo.CREATEDTIME <="Last day of the previous month " help would be very welcome.