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 check if value already exists in mysql database in php?
How many rows can a mysql table hold?
Does mysql support sequence?
How to show table structure mysql?
What is msql?
How will you export tables as an xml file in mysql?
What are the three types of queries?
What is the full meaning of mysql?
Where is mysql data stored linux?
What is the use of innodb in mysql?
How to escape special characters in sql statements?
What are different types of queries?
What happens if null values are involved in expressions?
Explain about the architecture of MYSQL?
How to allow the user "sonia" to connect to the server from localhost using the password "passwd". Login as root. Switch to the mysql db. Give privs. Update privs.