DateTime x = new DateTime();
DateTime y = new DateTime();
x = DateTime.Now;//当前时间
y = x;x = Convert.ToDateTime((DateTime.Now.ToString("yyyy-MM-01")).AddMOnths(-1).ToShortDateString());//上月1号0:00:00秒//上月最后一天的最后一刻
y = Convert.ToDateTime((DateTime.Now.ToString("yyyy-MM-01")).AddDays(-1).ToShortDateString());
y = Convert.ToDateTime(y.ToString("yyyy-MM-d")+ " 23:59:59");
//此时,你可以查询上月的数据了:
select * from dt where rq>=x and rq<=y...