1
我尝试从日数中获取年,月,日的数量。我尝试这样做:如何将日期转换为年,月,日日期格式
SELECT enddate,startdate,extract(month from enddate)-extract(month from startdate)
FROM workexpdeails ;
我尝试从日数中获取年,月,日的数量。我尝试这样做:如何将日期转换为年,月,日日期格式
SELECT enddate,startdate,extract(month from enddate)-extract(month from startdate)
FROM workexpdeails ;
SELECT
enddate
,startdate
,(YEAR(enddate)*12+MONTH(enddate)) - (YEAR(startdate)*12+MONTH(startdate))
as diffmonths
,DATEDIFF(enddate, startdate) as diffdays
FROM workexpdeails ;
参见:http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html
你有什么用 “的年月日数” 呢? – 2011-12-22 11:09:55