The usage of the oracle add_months function is explained in detail using the oracle add_months function, you can get a certain time before or after n months, if you have encountered similar problems before, take a look. Www.2cto.com if you need to retrieve data from the previous month and perform this operation every day, you need to change the time each time, which is indeed very troublesome, so I thought of the oracle add_months function. The oracle add_months function: oracle add_months (time, months) function can get the time before or after a certain time, such as select add_months (sysdate, -6) from dual; the query result is select add_months (sysdate, 6) from dual; the query result is www.2cto.com my examle: select distinct (t. mobile) from twaplogon t where to_char (t. logontime, 'yyyy-mm') = to_char (add_months (sysd Ate,-1), 'yyyy-mm') and above are the usage methods of the oracle add_months function.