Home > database >  How to compare two dates sent a few months? Date format including seconds or days
How to compare two dates sent a few months? Date format including seconds or days

Time:09-23


Is such two time, field A and B, is usually A> B, B> A possible situation, need to use A - B get difference for A few months, and then calculate the average difference

CodePudding user response:

1, timestamp can achieve your requirements,

2, the two time is presupposed directly, also can draw a number of days to,

CodePudding user response:

Select avg (months_between (" dead time ", "net time")) from the table.

CodePudding user response:

Date/time can directly do subtraction operation, the unit is a day, according to the units you asked for,
  • Related