SQL按⽉统计
SQL 按⽉统计,DISTINCT去重⽇统计
日本好看动漫SELECT SUM(psar_bank_pos_recon_money) AS total_amount,DATENAME(YEAR,psar_data) AS year, DATENAME(MONTH,psar_data) AS month FROM PAY_SYSTEM_ACCOUNT_RECONCILIATION WHERE psar_data>=@begin_month AND psar_data<@end_month
GROUP BY DATENAME(YEAR,psar_data),DATENAME(MONTH,psar_data) ORDER BY DATENAME(YEAR,psar_data) ASC,DATENAME(MONTH,psar_data) ASC 注:DATENAME(YEAR,psar_data) 获取指定字段的年份,还有其他可选参数
DISTINCT去重⽇统计
SELECT COUNT(*) AS count, COUNT(DISTINCT lci_erector_openid) AS lci_ere_count,
COUNT(DISTINCT tc_cu_shop_id) AS shop_count,
DATEPART(YEAR,lci_erector_code_scantime) AS lciYear,
海外留学申请
DATEPART(MONTH,lci_erector_code_scantime) AS lciMonth,成大事者不拘小节
DATEPART(DAY,lci_erector_code_scantime) AS lciDay
FROM dbo.LOTTERY_CODE_INFO INNER JOIN dbo.TC_CUSTOMERS ON lci_erector_openid=tc_cu_weixin_open_id
WHERE lci_erector_code_scantime>=@begin_date AND lci_erector_code_scantime<@end_date
写母亲的诗句
AND (tc_cu_address LIKE'%'+@address+'%'OR@address='全国')
AND lci_type in (40,140)
GROUP BY DATEPART(YEAR,lci_erector_code_scantime),
DATEPART(MONTH,lci_erector_code_scantime),DATEPART(DAY,lci_erector_code_scantime)
永不褪色的青春ORDER BY DATEPART(YEAR,lci_erector_code_scantime),
DATEPART(MONTH,lci_erector_code_scantime),DATEPART(DAY,lci_erector_code_scantime)污水预处理
6月是什么星座关键点:
鲸类COUNT(DISTINCT lci_erector_openid)