substring和 DATE_FORMAT截取年,月
Posted xiaowoniulx
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了substring和 DATE_FORMAT截取年,月相关的知识,希望对你有一定的参考价值。
SELECT x.core_enterprise_id, x.years, x.months, SUM( x.invoice_amount ), SUM( x.invoice_tax_amount ), SUM( x.total_amount ) , x.invoice_date FROM ( SELECT a.core_enterprise_id, a.account_receivable, b.pay_id, b.invoice_amount, b.invoice_tax_amount, b.total_amount, b.invoice_date, substring( DATE_FORMAT( b.invoice_date, ‘%Y%m‘ ), 5 ) months, DATE_FORMAT( b.invoice_date, ‘%Y‘ ) years FROM biz_pay_billing_info b, biz_pay_comfirm_info a WHERE b.sys_status = 1 AND b.pay_id = a.uuid AND a.sys_status = 1 ) x WHERE 1= 1 AND x.months = 01 AND x.core_enterprise_id=‘c1003‘ GROUP BY x.core_enterprise_id, x.months, x.years;
以上是关于substring和 DATE_FORMAT截取年,月的主要内容,如果未能解决你的问题,请参考以下文章