本文介绍了我是计算日明智的报告,但它唯一的显示日我想捕捉月和年的单一查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  SELECT  datename(DAY,trandate) as  Months,SUM (TOTALMARGIN) AS  TOTALMARGIN,SUM(AVAILABLEMARGIN) AS  TOTAVLBMARG 
INTO #DAYWISECLIENTMARGIN
FROM tableA
WHERE
TRANDATE BETWEEN ' apr 1 2012' AND ' 2012年4月30日23:59'
group by datename(DAY,trandate)
ORDER BY datename(DAY,trandate)



输出

=========================

日期TOTALMAR GIN TOTAVLBMARG 
1 100000 10000

2 2000 30000



我想要输出应该包含月份日的年份如

日期月份totalmargin totalavlbal 







亲切帮助.. 。

解决方案

SELECT datename(DAY,trandate) as Months,SUM(TOTALMARGIN) AS TOTALMARGIN,SUM(AVAILABLEMARGIN) AS TOTAVLBMARG
INTO #DAYWISECLIENTMARGIN
FROM tableA
WHERE 
TRANDATE BETWEEN 'apr 1 2012' AND 'APR 30 2012 23:59'
group by  datename(DAY,trandate)
ORDER BY datename(DAY,trandate)


output
=========================

date   TOTALMARGIN  TOTAVLBMARG
1       100000        10000

2        2000          30000


I want to output should contained month day year separate like

date month year  totalmargin   totalavlbal




kindly help...

解决方案


这篇关于我是计算日明智的报告,但它唯一的显示日我想捕捉月和年的单一查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-03 02:38