0

This query returns 7

SELECT datediff('20130510', '20130503') 

but This query returns error error string is function datediff does not exist

SELECT datediff(to_dt, from_dt) FROM `tbl_test` 

I don't know the reason please help me..

tohuwawohu
13.8k4 gold badges45 silver badges63 bronze badges
asked Jun 27, 2013 at 4:22
1
  • what data type are to_dt and from_dt Commented Jun 27, 2013 at 4:32

1 Answer 1

1

Ok, I created a table Date on one of my phpmyadmin databases, just to see how this query works.

My table has 2 columns, date_of_birth and date_of_death, both of type date. I inserted some 5 or 6 tuples. And after that typed in this query:

SELECT DATEDIFF(date_of_birth, date_of_death) FROM Date;

It worked just fine. Gave me 7,53, 365, 733...ergo, the correct results, without any error.

I think there is something wrong in your database.

answered Jun 27, 2013 at 10:16
Sign up to request clarification or add additional context in comments.

1 Comment

I could find some comments for this problem by google search. may be mysql bug.. bugs.mysql.com/bug.php?id=14124 this query did not return error.. SELECT datediff(to_dt, from_dt) FROM tbl_test limit 0, 10 I intend to use datediff function with limit clause

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.