1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Question about Select Query VERY URGENT

Discussion in 'Software Development' started by sudhakararaog, Oct 30, 2007.

Thread Status:
Not open for further replies.
  1. sudhakararaog

    sudhakararaog Thread Starter

    Sep 6, 2007
    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'";


    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.

  2. Chicon


    Jul 29, 2004
    Hi sudhakararaog,

    Did you try :

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

    You may find your 'happiness' on this page.
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 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/645605

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice