/    Sign up×
Community /Pin to ProfileBookmark

fetch the records of a particular month

hi

i have a mysql table.it has 2 fields

1.register_number 2.registered_date

values
333333—-2007/08/21
245678—-2007/06/30
123123—-2007/09/20
123222—-2007/09/21
125553—-2007/09/22

i have select box on a page and it’s option values from january-december.
when i select the month from select box and press submit button,it should fetch those records that are registered in that particular month.

i just need the sql query logic to fetch the records of that particular month.
any of your help will be surely appreciated

thanks
mrjameer

to post a comment
PHP

1 Comments(s)

Copy linkTweet thisAlerts:
@michael879Sep 25.2007 — http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html

you should find all the date manipulation functions in there.

basically just use:

SELECT * FROM table WHERE MONTH(registered_date)==?

where you replace ? with the number representation of the month.

for future reference, try google and dev.mysql.com. I didnt know the answer to this question when I first saw your post but it took me under a minute to find it out.
×

Success!

Help @roshanjameer spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...