日期:2014-05-17  浏览次数:21118 次

———Oracle中,如何Select出“上个月”或“两个月前”的数据?
假设A表有两列,其中Ent_Date字段是Date型。
那如果取出Ent_Date是两个月前的数据呢?

假如现在是07年1月19日,我要取出的数据是Ent_Date从06年11月1日至06年11月30日之间的数据,如何写这个Select语句?

另:Oracle是不是不支持   month()函数?

------解决方案--------------------
select * from your_table
where ent_date> ... and ent_date <....
------解决方案--------------------
要取出的数据是Ent_Date从06年11月1日至06年11月30日之间的数据

select * from tablename where to_char(ent_date, 'yyyymmdd ')> =20061101 and to_char(ent_date, 'yyyymmdd ') <=20061130;