Jump to content

Archived

This topic is now archived and is closed to further replies.

elioncho

Help in Date Query

Recommended Posts

Hi,

Suppose I have a table like this one

ID      DATE            NAME
1    2006-10-03    ELIAS
2    2006-10-04    ELIAS
3    2006-04-07    JOHN

I want the user to be able to do a search 'by month'  by selecting a month from a selection list. How can I compare the month the user chooses with the month in the DATE Format stored in the database? I there an esay way to compare the DATE format with a month?

Thanks,
ElĂ­as

Share this post


Link to post
Share on other sites
[quote author=Firemankurt link=topic=110842.msg449066#msg449066 date=1160362049]
SELECT *
FROM `table`
WHERE `DATE` LIKE '%-12-%'
[/quote]
Please don't -- use the MONTH() function that was designed for this purpose.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.