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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

List some comparisons operators used in mysql?

535


What is pdo in mysql?

515


How we can get the current date in mysql?

512


Write a query to find duplicate rows in table?

492


How do I delete a mysql user?

467






How important is to list the column names when doing an insert?

595


Where is the mysql database stored?

483


What is session variable in mysql?

503


What is mysqli_result?

509


What is dblink?

486


What is back end and front end?

470


What is the latest version of mysql?

501


What storage engines are used in MySQL?

521


Can you tell the difference between ereg_replace() and eregi_replace()?

533


What does blob mean in mysql?

494