Timestampdiff

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Joel

    Timestampdiff


    Hi,

    Anyone know why I'm getting syntax error by Timestampdiff?
    It doesn't like Timestampdiff(D ay,Trans_date,C urDate())>=91
    What am I doing wrong?

    Here's the full Sql statement:

    "Select * From Artransp Where Date_Paid is null And
    Timestampdiff(D ay,Trans_date,C urDate())>=91 And `Cust_#` = " &
    PBV_lngCustomer Number & " Order By Trans_Type, Trans_Date, Record_Number"


  • Bill Karwin

    #2
    Re: Timestampdiff

    Joel wrote:
    [color=blue]
    > Anyone know why I'm getting syntax error by Timestampdiff?
    > It doesn't like Timestampdiff(D ay,Trans_date,C urDate())>=91
    > What am I doing wrong?[/color]

    Are you using MySQL 5.0? The TIMESTAMPDIFF function is available as of
    MySQL 5.0.0, according to the docs.

    Regards,
    Bill K.

    Comment

    • Joel

      #3
      Re: Timestampdiff


      I'm using 2.5 ... I guess that explains it! Is there any work around? Or is
      there a way I can download 5.0?

      Also I set up a new database called Clean Country however, when I change my
      Odbc driver Database name to Clean Country it still points to the current DB
      (which is test). What am I doing wrong?

      I appreciate all the help your providing me with!


      "Bill Karwin" <bill@karwin.co m> wrote in message
      news:cofr2o044b @enews1.newsguy .com...[color=blue]
      > Joel wrote:
      >[color=green]
      > > Anyone know why I'm getting syntax error by Timestampdiff?
      > > It doesn't like Timestampdiff(D ay,Trans_date,C urDate())>=91
      > > What am I doing wrong?[/color]
      >
      > Are you using MySQL 5.0? The TIMESTAMPDIFF function is available as of
      > MySQL 5.0.0, according to the docs.
      >
      > Regards,
      > Bill K.[/color]


      Comment

      • Bill Karwin

        #4
        Re: Timestampdiff

        Joel wrote:
        [color=blue]
        > I'm using 2.5 ... I guess that explains it! Is there any work around? Or is
        > there a way I can download 5.0?[/color]

        MySQL 5.0 is currently in an alpha stage of development. It isn't
        intended to be used for real projects, according to the MySQL web site.
        If you really want to use it, though, it's available for download:


        However, you could probably find another method to find the difference
        in days between two dates:

        SELECT ...
        FROM Artransp
        WHERE Date_Paid IS NULL AND
        TO_DAYS(CURDATE ()) - TO_DAYS(Trans_d ate) >= 91 AND ...
        [color=blue]
        > Also I set up a new database called Clean Country however, when I change my
        > Odbc driver Database name to Clean Country it still points to the current DB
        > (which is test). What am I doing wrong?[/color]

        The name of the DSN is independent from the MySQL database name to which
        it connects. In the Windows ODBC administrator, select your DSN and
        click the Configure button. I'm guessing that you've altered the
        "Windows DSN name". To get the DSN to point to a different MySQL
        database, set that in the field labeled, "MySQL database name".

        Regards,
        Bill K.

        Comment

        • Andrew

          #5
          Re: Timestampdiff

          Isn't that a dumb "gotcha"! Same thing happened to me two weeks ago.
          I wanted to find the difference between two date/times, so I RTFM'ed
          the mySQL online documentation, incorporated the new functions I
          needed into my SQL statement, ran it, and it didn't work. I pulled my
          hair out for a couple of hours trying to get it to work or find
          another way to do it to no avail. A few days later I checked with my
          hosting company, and they had mySQL 4.0 installed so none of the
          functions were available in the first place!

          -Andrew K.

          Comment

          • Leif

            #6
            Re: Timestampdiff


            "Andrew" <akoper@web4000 .com> skrev i en meddelelse
            news:42cdd29b.0 411291906.78b3d dfc@posting.goo gle.com...[color=blue]
            > Isn't that a dumb "gotcha"! Same thing happened to me two weeks ago.
            > I wanted to find the difference between two date/times, so I RTFM'ed
            > the mySQL online documentation, incorporated the new functions I
            > needed into my SQL statement, ran it, and it didn't work. I pulled my
            > hair out for a couple of hours trying to get it to work or find
            > another way to do it to no avail. A few days later I checked with my
            > hosting company, and they had mySQL 4.0 installed so none of the
            > functions were available in the first place![/color]

            It would be nice if it was possible to enter the version of software, when
            using an online-manual.
            Then it should be highlighted if the function was available or not.

            I find this "not in my version" often in both mysql and php.

            Leif
            [color=blue]
            >
            > -Andrew K.[/color]


            Comment

            • Bill Karwin

              #7
              Re: Timestampdiff

              Leif wrote:[color=blue]
              > It would be nice if it was possible to enter the version of software, when
              > using an online-manual.
              > Then it should be highlighted if the function was available or not.[/color]

              Functions that are additions to recent versions of MySQL are well noted
              as such in the documentation. In fact, much better than in most other
              commercial products!

              Regards,
              Bill K.

              Comment

              Working...