Sql querry for retreiving data using start date and end date

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sobha
Forum Commoner
Posts: 56
Joined: Wed Jul 15, 2009 9:08 pm

Sql querry for retreiving data using start date and end date

Post by sobha »

Hi

Sql querry for retreiving data using start date and end date

Regards
User avatar
susrisha
Forum Contributor
Posts: 439
Joined: Thu Aug 07, 2008 11:43 pm
Location: Hyderabad India

Re: Sql querry for retreiving data using start date and end date

Post by susrisha »

Code: Select all

 
SELECT * FROM `yourtable` WHERE recordDate BETWEEN 'startdate' AND 'endDate';
 
eg:

Code: Select all

 
SELECT * FROM `dt_tb` WHERE dt BETWEEN '2005-01-01' AND '2005-12-31'
 
User avatar
neuroxik
Forum Commoner
Posts: 25
Joined: Tue Aug 11, 2009 10:32 pm

Re: Sql querry for retreiving data using start date and end date

Post by neuroxik »

susrisha wrote:

Code: Select all

 
SELECT * FROM `yourtable` WHERE recordDate BETWEEN 'startdate' AND 'endDate';
 
eg:

Code: Select all

 
SELECT * FROM `dt_tb` WHERE dt BETWEEN '2005-01-01' AND '2005-12-31'
 
I was gonna answer him but seeing he almost asks as if "cook my dinner and shut up"... bah, people want help without even providing effort.
Post Reply