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 do we delete a row in a table?
How to use sum function in where clause in mysql?
How to check if a record exists in a mysql database php?
Which is better mysql or mssql?
What is triggers?
What is truncate command?
Do while loop in mysql procedure?
How many sql ddl commands are supported by 'mysql'?
If you are assigned a task, to find the information of procedures. What are the basic commands that you will use to do so?
Is mysql query case sensitive?
Consider a scenario where you have to send an email to a client from the sql database. How do you think you can achieve this task?
How do I delete a mysql user?
how you will Create a database on the mysql server with unix shell.
Consider you have a composite index of three columns. Now, you have to provide the value of two columns in the where clause of a select query. Do you think index can be used for the operation?
What is pragma autonomous_transaction?