473,799 Members | 3,005 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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"
Jul 20 '05 #1
6 5069
Joel wrote:
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?


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.co m> 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(D ay,Trans_date,C urDate())>=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_d ate) >= 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.goo gle.com...
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
9276
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
12130
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 SQL error: SQLCODE: -443, SQLSTATE: 38552, SQLERRMC: SYSFUN.TIMESTAMPDIFF;TIMESTAMPDIFF;SYSFUN:03 on db2 8.2/RHEL 3 Any pointers?
7
9147
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 there a better way to do it? CREATE FUNCTION TimeDiff(Time_1 TIME, Time_2 TIME) RETURNS TIME SPECIFIC TimeDiff DETERMINISTIC
8
1832
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 get the current system timestamp? 2) how do I subtract the first from the second?
2
20502
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. What I want is to subtract the DATETIME values to determine the number of seconds between their time. In the WHERE clause I also want to filter the selected rows if the difference in the DATETIME values is less that 900 (seconds). Any help?
2
5811
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 based on the following two tables: row_id doc_id order_time completion_time ----------- -------------------- ------------------------------------------- ------------- 1 Doc1 ...
1
6573
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 UserMain.UserId,UserMain.Username from UserMain,UserMisc where UserMain.UserId = UserMisc.UserId and timestampdiff(day,UserMisc.LoginDate,current_timestamp)>30; cant understand as to whats wrong with this. any help would be appreciated.
7
54944
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 display. I tried "results=enddate-startdate" dates have month, day, year,and time of day. After this calculation I end up with no results. Any help would be appreciated. Walt
4
50200
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, '2006-09-09 14:00', '2006-09-09 16:00' ) ,( 2, '2006-09-10 09:00', '2006-09-10 17:00' ) ,( 3, '2006-09-11 13:30', '2006-09-11 14:45' )
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7564
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.