select * from table1 where PERIOD_DIFF(date_format(now(),'%Y%m'),date_format(fieldname,'%Y%m')) = 1
说明:
查询table1的fieldname为上月的数据。
PERIOD_DIFF()函数返回两个时间相差的月份数。