I have a table called oth_mbr. I need to get 3 years of data month wise. current date minus 36 months and each month data betwwe from_dt and thru_dt needs to be fetched.
data shoulbe be in below formate
DATE , COLUMN A, COLUMN B
2017-08-01,FEP000,FPr
2017-09-01,FEP000,FPr
2017-10-01,FEP000,FPr
.
.
.
2020-08-01,FEP000,FPr
tried below query but this gives only one data
SEL distinct ADD_MONTHS(DATE - DATE MOD 100 + 1,- 36) AS DATE ,
COLUMN 1,COLUMN 2
OTH_MBR
WHERE
ADDD_MONTHS(DATE - DATE MOD 100 + 1,- 36) BETWEEN FROM_DT AND THRU_DT
Result for above query is
2017-08-01,FEP000,FPr
from_dt
abdthru_dt
columns in your table? And you want one row per month for the last tree years when they match from/thru