在SQL Server中显示小时 [英] Show hours in 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屋!