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
-
what data type are to_dt and from_dtbugwheels94– bugwheels942013年06月27日 04:32:10 +00:00Commented Jun 27, 2013 at 4:32
1 Answer 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
GothamCityRises
2,1022 gold badges27 silver badges45 bronze badges
Sign up to request clarification or add additional context in comments.
1 Comment
subzero
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 clauselang-sql