0

How do I select the date with a specific month? For example I have in my table:

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

And I want to get only the dates from march. The result should be:

1-mar-2015
16-mar-2013
Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786
stefan oros
  • 1
  • 1
  • 1
  • 3
    What database are you using? Please tag appropriately. – Gordon Linoff May 01 '16 at 12:40
  • 1
    For **SQL Server** : [Getting only Month and Year from SQL DATE](http://stackoverflow.com/questions/1781946/getting-only-month-and-year-from-sql-date) – Pரதீப் May 01 '16 at 12:46
  • 1
    For **Oracle** : [get month name from date in oracle](http://stackoverflow.com/questions/4497456/get-month-name-from-date-in-oracle) – Pரதீப் May 01 '16 at 12:47
  • 1
    For **Mysql** : [How do I extract Month and Year in a MySQL date and compare them?](http://stackoverflow.com/questions/7830987/how-do-i-extract-month-and-year-in-a-mysql-date-and-compare-them) – Pரதீப் May 01 '16 at 12:48
  • 2
    For **Postgres** : [Selecting by month in PostgreSQL](http://stackoverflow.com/questions/8863156/selecting-by-month-in-postgresql) – Pரதீப் May 01 '16 at 12:49

1 Answers1

2

Databases have ways of extracting date parts. The ANSI standard method is:

where extract(month from date) = 3

Other databases support functions such as month() or to_char() to achieve the same purpose.

Gordon Linoff
  • 1,242,037
  • 58
  • 646
  • 786