finding a date with month year

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

finding a date with month year

Post by dstefani »

I want to get a set of records all from the same month and I only have the month and year to give to MySQL and the date in the table is in the standard MySQL format (yyyy-mm-dd) ?

Thanks,

- dstefani
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Re: finding a date with month year

Post by volka »

dstefani wrote:and the date in the table is in the standard MySQL format (yyyy-mm-dd) ?
Does that mean the type of the file is DATE or DATETIME?
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

Post by dstefani »

DATE

Thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

if you have e.g. month=3 and year=2007 you can create a query like

Code: Select all

WHERE datefield > '2007-03-01' and datefield < '2007-04-01'
Post Reply