I finding the sum of revenue last month. Currently, I'm filtering by giving where condition. For example if I need last month's data given the current date is '20191111'. My query to get October's data is
Select sum(revenue)
from Table 1
where date between '20191001' and '20191031'
Note : My date column is a string. How can I modify it to fetch the last month's record automatically?