473,322 Members | 1,473 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Timestampdiff


Hi,

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

Here's the full Sql statement:

"Select * From Artransp Where Date_Paid is null And
Timestampdiff(Day,Trans_date,CurDate())>=91 And `Cust_#` = " &
PBV_lngCustomerNumber & " Order By Trans_Type, Trans_Date, Record_Number"
Jul 20 '05 #1
6 5025
Joel wrote:
Anyone know why I'm getting syntax error by Timestampdiff?
It doesn't like Timestampdiff(Day,Trans_date,CurDate())>=91
What am I doing wrong?


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

Regards,
Bill K.
Jul 20 '05 #2

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" <bi**@karwin.com> wrote in message
news:co********@enews1.newsguy.com...
Joel wrote:
Anyone know why I'm getting syntax error by Timestampdiff?
It doesn't like Timestampdiff(Day,Trans_date,CurDate())>=91
What am I doing wrong?


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

Regards,
Bill K.

Jul 20 '05 #3
Joel wrote:
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?
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:
http://dev.mysql.com/downloads/mysql/5.0.html

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_date) >= 91 AND ...
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?


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.
Jul 20 '05 #4
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.
Jul 20 '05 #5

"Andrew" <ak****@web4000.com> skrev i en meddelelse
news:42**************************@posting.google.c om...
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!
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

-Andrew K.

Jul 20 '05 #6
Leif wrote:
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.


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.
Jul 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Kenneth | last post by:
Hi Is it possible to see all kinds of executed SQL-statements in a logfile? If yes, how do I do that and how much information does it log? Thanks, Kenneth
1
by: Shishir | last post by:
The sql select TIMESTAMPDIFF(1,CHAR(TIMESTAMP('2001-09-29-11.25.42.483219') - TIMESTAMP('2001-09-26-12.07.58.065497'))) from sysibm.sysdummy1 works in db2 8.1.2/RHEL 2.1 but gives the error DB2...
7
by: Brian Tkatch | last post by:
I had two TIME fields that i wanted to know the difference in between them. I saw TIMESTAMPDIFF but nothing equivalent for TIME. Further, i want HH:MM:SS format. So, i wrote this FUNCTION. Is...
8
by: Super Mango | last post by:
Hi everubody, I have a timestamp field in a mysql DB and I want to know how much time has past since that timestamp. is it possible? Say that I have this value in a variable - 1) how do I...
2
by: deepbright | last post by:
I'm having trouble understanding the MySQL docs on how to subtract two DATETIME values. I have two tables that have a DATETIME column. In my SELECT I am doing a JOIN to bring in both sets of rows....
2
by: melisimp | last post by:
I am trying to select the following averages from the tables below. average order turn time in minutes (completion_time - order_time), average fee of the final invoice, and the average # of invoices...
1
by: gomzi | last post by:
hi, When i try to delete rows in a table by checking the values in an other table, then i receive this error:- "unknown table 'userid' in multi delete" Here's the query...
7
by: walt | last post by:
Hello, I have been trying to calculate the difference between two date and display the difference in hours and minutes (HH:MM). I can't get it calculate properly and I can't hours and minutes to...
4
by: lenygold via DBMonster.com | last post by:
I found this example in MYSQL: create table events ( id integer not null primary key , datetime_start datetime not null , datetime_end datetime not null ); insert into events values ( 1,...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.