Question about Select Query VERY URGENT

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

sudhakararaog

Thread Starter
Joined
Sep 6, 2007
Messages
117
I have a table in mysql which i have defined as date and the values that are inserted have the following format for example : 2007-10-30 08:02:40

My requirement is to run a select query to retrieve a particular column on a specific date ex= "SELECT columnname from tablename where columnname='$dt'";

$sd=mysql_query($selectdate);
$sdr=mysql_num_rows($sd);

if($sdr > 0)
{ echo "Records found"
}
else {
echo "No Records found";
}

This works fine only if i manually change the format of the date field to the following format = 2007-10-30

I have more than 2000 records in the table so its not a good idea to edit the dates.

MY QUESTION IS = without editing the value of the date and the value of the date field being 2007-10-30 08:02:40, how can i use a select query which would ignore 08:02:40 and consider 2007-10-30 ONLY.

I need to implement this at the earliest. Any help in this regard will be greatly appreciated.

Thanks.
 
Joined
Jul 29, 2004
Messages
6,650
Hi sudhakararaog,

Did you try :

SELECT .... FROM tableName WHERE DATE(columnName) = '2007-10-30'

You may find your 'happiness' on this page.
;)
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top