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
How to dump one database for backup.
Can you tell how many values can set the function of mysql to consider?
How do you shutdown a mysql database?
What is the use of i-am-a-dummy flag in mysql?
What is difference between pdo and mysqli?
Do while loop in mysql procedure?
How do I create a stored procedure in mysql?
What is back end and front end?
Is mysql a backend?
List the different types of normalization?
How can you import tables from a sql file into a database by using the mysql client?
How does mysql store data?
What are programming functions?
What are the disadvantages of mysql?
Can I install mysql on mac?