How to you compare dates in a query in Mysql

Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default How to you compare dates in a query in Mysql

    Dear friends,

    Plesae help in finding the correct syntax for comparing two dates in a query
    in MySql database

    Thank you
    Subodh Gupta


    Safal Solutions Guest

  2. Similar Questions and Discussions

    1. Help with query using dates
      I am trying to select records based on a date range, this is the query, it doesn't like the format of the ##form.StartDate## and ##form.EndDate: ...
    2. MySQL Dates
      Hello, I have CFM pages with Searching on Dates in MySQL. As you know MySQL Dates are "yyyy-mm-dd" format. However, we want date entering formats...
    3. Need to compare query results
      I have two queries. #1 and #2. I need to compare the results of each query with one another. If query #2 has information (actually just one...
    4. Web form dates to MySQL
      I am building a admin form (PHP/MySQL), so staff can input Job Vacancy descriptions into the Website via a Web form that can be displayed on the...
    5. Compare dates for conflict
      Hi folks - Writing a scheduling app for equipment. I need to be sure that any new request does not conflict with a request already in the DB. ...
  3. #2

    Default Re: How to you compare dates in a query in Mysql

    take a look into mysql-manual > 6.3.1.2 Comparison Operators
    ciao SVEN

    Bogdan Stancescu wrote:
    > Depends on what exactly you're after, but for strict comparison
    > arithmetic operators work as expected (<, >, =).
    >
    > Bogdan
    >
    > Safal Solutions wrote:
    >
    >> Dear friends,
    >>
    >> Plesae help in finding the correct syntax for comparing two dates in
    >> a query in MySql database
    >>
    >> Thank you
    >> Subodh Gupta

    Sven Guest

  4. #3

    Default Re: How to you compare dates in a query in Mysql

    Imagine ur table name as Test 1 which contains two columns "createdate" & "updatedate" & Now if you want to get the records which are created between '01/01/2010' and '31/01/2010' and updated between '01/02/2010' and '28/02/2010' Then Your Query Goes in the below way :

    select * from Test1
    WHERE Createdate between '2010-01-01' and '2010-01-31'
    AND Updatedate between '2010-02-01' and '2010-02-28'

    The above query retrieves the data in between the given dates and does not include the action on the given dates....


    Regards,
    Naresh Vodnala
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139