MySQL中或者sql sever中如何取得日期字段的天数,先要返回对应月份的天数,然后用累计工时字段/天数字段=日平均工时
请问需要怎么实现?
SELECT
field0019 AS 工作日期,
field0020 AS 年月, -- 此处年月为文本数据类型
field0005 AS 类型,
field0006 AS 品牌,
field0007 AS 型号,
field0001 AS 整机编号,
field0008 AS 缩写编号,
field0009 AS 累计表时,
field0021 AS 本日运作工时,
field0022 AS 本日出勤情况,
field0010 AS 累计出勤,
field0009/field0010 AS 平均工作时长
FROM
formmain_18477 AS a
LEFT JOIN formson_18480 AS b ON b.formmain_id = a.id
ORDER BY
b.field0019
--取field0020 年月字段返回的当月天数,从而求得field0009累计表时间/当月天数=日平均工时