at first i'm using
datediff('d', a.due_date, current_date);
but it takes too long to get the result
but how can i subtract the current_date - a.due_date
and still get the same result like when i use datediff?
thank you



at first i'm using datediff('d', a.due_date, current_date); but it takes too long t..

Answer / sudhanshu_kmr


for getting date difference you can use it.......

select to_days(now())- to_days(date);


for example-


SELECT TO_DAYS(NOW())- TO_DAYS('2010-12-01');




TO_DAYS(DATE) command return a number which is total no. of
days between '0000-01-01' and the given date.




Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More MySQL Interview Questions

What is the datatype of image?

0 Answers  


How can an index be declared in mysql?

0 Answers  


how you will Create a database on the mysql server with unix shell.

0 Answers  


How to insert html code into mysql database using php?

0 Answers  


Can I use mysql for free?

0 Answers  






Why we use mongodb instead of mysql?

0 Answers  


What is the difference between mysql_fetch_array and mysql_fetch_object?

4 Answers   CTS,


What is the purpose of using ifnull() function?

0 Answers  


What is database clustering in mysql?

0 Answers  


What does mysql workbench do?

0 Answers  


What is the latest version of mysql?

0 Answers  


How to Creating a new user. Login as root. Switch to the MySQL db. Make the user. Update privs.

0 Answers  


Categories