当前位置: 代码迷 >> Oracle开发 >> ———Oracle中,怎么Select出“上个月”或“两个月前”的数据
  详细解决方案

———Oracle中,怎么Select出“上个月”或“两个月前”的数据

热度:78   发布时间:2016-04-24 07:58:27.0
———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;

  相关解决方案