/    Sign up×
Community /Pin to ProfileBookmark

1- how to search from database between two dates
2- how to search from database on monthly bases
2- how to search from database on annualy bases

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@Brooksie155Sep 01.2006 — SELECT fields FROM table WHERE date >= [1st date] AND date <= [2nd date];

e.g. for all rows between 1st and 31st of January

SELECT fieldsFROM table WHERE date >= 2006-01-01 AND date <= 2006-01-31;

N.B. you may need to change the format of the datye string based on your database setup.


2- Do the same but set the dates as the 1st and last days of the month

3- Do the same but set the date as the 1st and last days of the year

if you are running this from php you can obtain the number of days in a given month by using date('t',[timestamp]);
×

Success!

Help @mahfooz 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 4.27,
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: @Yussuf4331,
tipped: article
amount: 1000 SATS,

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

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...