2016-05-01 55 views
0

如何選擇特定月份的日期? 例如,我有我的表:我如何選擇特定月份的日期?

1-mar-2015 
16-mar-2013 
12-feb-2016 
14-apr-2014 

而且我想只有從三月的日期。 結果應該是:

1-mar-2015 
16-mar-2013 
+3

你使用了哪個數據庫?請適當標記。 –

+1

對於** SQL Server **:[從SQL日期只獲得月和年](http://stackoverflow.com/questions/1781946/getting-only-month-and-year-from-sql-date) –

+1

For ** Oracle **:[從oracle獲取月份名稱的日期](http://stackoverflow.com/questions/4497456/get-month-name-from-date-in-oracle) –

回答

2

數據庫有方法提取日期部分。 ANSI標準方法是:

where extract(month from date) = 3 

其它數據庫支持功能,如month()to_char()來達到同樣的目的。

相關問題