在SQL Server中显示小时 [英] Show hours in sql server

查看:166
本文介绍了在SQL Server中显示小时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好所有访客
我有一份报告,我想在报告中显示按小时排列的销售额
例如:小时____________________金额
9-10 ____________________ $ 454,564
10-11 ___________________ $ 34,523

在我的桌子上,我只有这样的Date(09/01/2011 09:42:43).
如果我使用hours(fieldname),它只显示小时(9,10,11,....)
不是arrage(9-10,10-11 ,,,,,).
我该怎么办?
我应该在SQL Server或Crystal Report中进行设计吗?
最好的问候,

Hi all visitors
I have one report, in my report i want to show the sales amount of arrange of hours
EX:Hour____________________Amount
9-10____________________$454,564
10-11___________________$34,523

In my table i have only Date(09/01/2011 09:42:43) like this.
If i use hours(fieldname), it just show the hour only(9,10,11,....)
not arrage(9-10,10-11,,,,,,).
How can i do that?
Should i design in sql server or in Crystal report?
Best Regards,

推荐答案

454,564
10-11 ___________________
454,564
10-11___________________


34,523

在我的桌子上,我只有这样的Date(09/01/2011 09:42:43).
如果我使用hours(fieldname),它只显示小时(9,10,11,....)
不是arrage(9-10,10-11 ,,,,,).
我该怎么办?
我应该在SQL Server或Crystal Report中进行设计吗?
最好的问候,
34,523

In my table i have only Date(09/01/2011 09:42:43) like this.
If i use hours(fieldname), it just show the hour only(9,10,11,....)
not arrage(9-10,10-11,,,,,,).
How can i do that?
Should i design in sql server or in Crystal report?
Best Regards,


我认为在SQL Sever中它更容易.尝试使用此

I think it''s easier in SQL Sever. Try using this

SELECT DatePart(hour, hour) FROM Table WHERE hour is not null


然后分组,然后用剩余的金额完成其余的工作.
然后只需在水晶报表中显示结果即可.


and then group and do the rest with the amount.
Then just display the result in crystal report.


这篇关于在SQL Server中显示小时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆