SQL script collection

Get the records whose creation time and month of the current month are consistent with the current month, and count the sum of the amount
SELECT date_format(create_time, '%Y-%m') AS m,sum(amount) monthSalary FROM t_details
WHERE date_format(create_time, '%Y-%m') = date_format(now(), '%Y-%m') AND cid = 35 AND type = 1
GROUP BY m DESC LIMIT 1

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326620258&siteId=291194637