I have two date columns, Why? Edit: I found that if the two dates are within one month in MySQL, the direct subtraction gives the right result, but if the duration of the month, the problem can be a problem. Is that right? Probably, you are not stored in the form of dates, But in the form of wire. If they are stored in the form of dates, The subtraction will work as expected. When you decrease the two strings, like: Then, MySQL converts them into numbers based on major digits. In this case, both numbers start with date A and
dateB . If I decrease the
dateA to
dateB (
DATEDIFF (dateB, DateA) do not work . When using data in the table, I do not get the result below with direct subtraction.
SELECT DATE ('2013-01-31') - DATE ('2013-01-27 /
SELECT '2013-01-31' - '2013-01-27'
2013 , so both
2013 (If there were no digits in the beginning, the value would be
0 ). These numbers are reduced.
No comments:
Post a Comment